diff -r be944660c56a -r 3d72ae0968f4 wp/wp-includes/js/dist/block-editor.js --- a/wp/wp-includes/js/dist/block-editor.js Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-includes/js/dist/block-editor.js Tue Sep 27 16:37:53 2022 +0200 @@ -1,907 +1,9 @@ -this["wp"] = this["wp"] || {}; this["wp"]["blockEditor"] = -/******/ (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 = "tr0p"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "//Lo": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const blockDefault = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" -})); -/* harmony default export */ __webpack_exports__["a"] = (blockDefault); - - -/***/ }), - -/***/ "16Al": -/***/ (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__("WbBG"); - -function emptyFunction() {} -function emptyFunctionWithReset() {} -emptyFunctionWithReset.resetWarningCache = emptyFunction; - -module.exports = function() { - function shim(props, propName, componentName, location, propFullName, secret) { - if (secret === ReactPropTypesSecret) { - // It is still safe when called from React. - return; - } - var err = new Error( - 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + - 'Use PropTypes.checkPropTypes() to call them. ' + - 'Read more at http://fb.me/use-check-prop-types' - ); - err.name = 'Invariant Violation'; - throw err; - }; - shim.isRequired = shim; - function getShim() { - return shim; - }; - // Important! - // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. - var ReactPropTypes = { - array: shim, - bool: shim, - func: shim, - number: shim, - object: shim, - string: shim, - symbol: shim, - - any: shim, - arrayOf: getShim, - element: shim, - elementType: shim, - instanceOf: getShim, - node: shim, - objectOf: getShim, - oneOf: getShim, - oneOfType: getShim, - shape: getShim, - exact: getShim, - - checkPropTypes: emptyFunctionWithReset, - resetWarningCache: emptyFunction - }; - - ReactPropTypes.PropTypes = ReactPropTypes; - - return ReactPropTypes; -}; - - -/***/ }), - -/***/ "17x9": -/***/ (function(module, exports, __webpack_require__) { - -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -if (false) { var throwOnDirectAccess, ReactIs; } else { - // By explicitly using `prop-types` you are opting into new production behavior. - // http://fb.me/prop-types-in-prod - module.exports = __webpack_require__("16Al")(); -} - - -/***/ }), - -/***/ "1CF3": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["dom"]; }()); - -/***/ }), - -/***/ "1ZqX": +/******/ (function() { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ 6411: /***/ (function(module, exports) { -(function() { module.exports = window["wp"]["data"]; }()); - -/***/ }), - -/***/ "1iEr": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const chevronRight = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" -})); -/* harmony default export */ __webpack_exports__["a"] = (chevronRight); - - -/***/ }), - -/***/ "2gm7": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const chevronLeft = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" -})); -/* harmony default export */ __webpack_exports__["a"] = (chevronLeft); - - -/***/ }), - -/***/ "4eJC": -/***/ (function(module, exports, __webpack_require__) { - -/** - * Memize options object. - * - * @typedef MemizeOptions - * - * @property {number} [maxSize] Maximum size of the cache. - */ - -/** - * Internal cache entry. - * - * @typedef MemizeCacheNode - * - * @property {?MemizeCacheNode|undefined} [prev] Previous node. - * @property {?MemizeCacheNode|undefined} [next] Next node. - * @property {Array<*>} args Function arguments for cache - * entry. - * @property {*} val Function result. - */ - -/** - * Properties of the enhanced function for controlling cache. - * - * @typedef MemizeMemoizedFunction - * - * @property {()=>void} clear Clear the cache. - */ - -/** - * Accepts a function to be memoized, and returns a new memoized function, with - * optional options. - * - * @template {Function} F - * - * @param {F} fn Function to memoize. - * @param {MemizeOptions} [options] Options object. - * - * @return {F & MemizeMemoizedFunction} Memoized function. - */ -function memize( fn, options ) { - var size = 0; - - /** @type {?MemizeCacheNode|undefined} */ - var head; - - /** @type {?MemizeCacheNode|undefined} */ - var tail; - - options = options || {}; - - function memoized( /* ...args */ ) { - var node = head, - len = arguments.length, - args, i; - - searchCache: while ( node ) { - // Perform a shallow equality test to confirm that whether the node - // under test is a candidate for the arguments passed. Two arrays - // are shallowly equal if their length matches and each entry is - // strictly equal between the two sets. Avoid abstracting to a - // function which could incur an arguments leaking deoptimization. - - // Check whether node arguments match arguments length - if ( node.args.length !== arguments.length ) { - node = node.next; - continue; - } - - // Check whether node arguments match arguments values - for ( i = 0; i < len; i++ ) { - if ( node.args[ i ] !== arguments[ i ] ) { - node = node.next; - continue searchCache; - } - } - - // At this point we can assume we've found a match - - // Surface matched node to head if not already - if ( node !== head ) { - // As tail, shift to previous. Must only shift if not also - // head, since if both head and tail, there is no previous. - if ( node === tail ) { - tail = node.prev; - } - - // Adjust siblings to point to each other. If node was tail, - // this also handles new tail's empty `next` assignment. - /** @type {MemizeCacheNode} */ ( node.prev ).next = node.next; - if ( node.next ) { - node.next.prev = node.prev; - } - - node.next = head; - node.prev = null; - /** @type {MemizeCacheNode} */ ( head ).prev = node; - head = node; - } - - // Return immediately - return node.val; - } - - // No cached value found. Continue to insertion phase: - - // Create a copy of arguments (avoid leaking deoptimization) - args = new Array( len ); - for ( i = 0; i < len; i++ ) { - args[ i ] = arguments[ i ]; - } - - node = { - args: args, - - // Generate the result from original function - val: fn.apply( null, args ), - }; - - // Don't need to check whether node is already head, since it would - // have been returned above already if it was - - // Shift existing head down list - if ( head ) { - head.prev = node; - node.next = head; - } else { - // If no head, follows that there's no tail (at initial or reset) - tail = node; - } - - // Trim tail if we're reached max size and are pending cache insertion - if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) { - tail = /** @type {MemizeCacheNode} */ ( tail ).prev; - /** @type {MemizeCacheNode} */ ( tail ).next = null; - } else { - size++; - } - - head = node; - - return node.val; - } - - memoized.clear = function() { - head = null; - tail = null; - size = 0; - }; - - if ( false ) {} - - // Ignore reason: There's not a clear solution to create an intersection of - // the function with additional properties, where the goal is to retain the - // function signature of the incoming argument and add control properties - // on the return value. - - // @ts-ignore - return memoized; -} - -module.exports = memize; - - -/***/ }), - -/***/ "6fKw": -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -Copyright (c) 2014, Yahoo! Inc. All rights reserved. -Copyrights licensed under the New BSD License. -See the accompanying LICENSE file for terms. -*/ - - - -exports.match = matchQuery; -exports.parse = parseQuery; - -// ----------------------------------------------------------------------------- - -var RE_MEDIA_QUERY = /(?:(only|not)?\s*([^\s\(\)]+)(?:\s*and)?\s*)?(.+)?/i, - RE_MQ_EXPRESSION = /\(\s*([^\s\:\)]+)\s*(?:\:\s*([^\s\)]+))?\s*\)/, - RE_MQ_FEATURE = /^(?:(min|max)-)?(.+)/, - RE_LENGTH_UNIT = /(em|rem|px|cm|mm|in|pt|pc)?$/, - RE_RESOLUTION_UNIT = /(dpi|dpcm|dppx)?$/; - -function matchQuery(mediaQuery, values) { - return parseQuery(mediaQuery).some(function (query) { - var inverse = query.inverse; - - // Either the parsed or specified `type` is "all", or the types must be - // equal for a match. - var typeMatch = query.type === 'all' || values.type === query.type; - - // Quit early when `type` doesn't match, but take "not" into account. - if ((typeMatch && inverse) || !(typeMatch || inverse)) { - return false; - } - - var expressionsMatch = query.expressions.every(function (expression) { - var feature = expression.feature, - modifier = expression.modifier, - expValue = expression.value, - value = values[feature]; - - // Missing or falsy values don't match. - if (!value) { return false; } - - switch (feature) { - case 'orientation': - case 'scan': - return value.toLowerCase() === expValue.toLowerCase(); - - case 'width': - case 'height': - case 'device-width': - case 'device-height': - expValue = toPx(expValue); - value = toPx(value); - break; - - case 'resolution': - expValue = toDpi(expValue); - value = toDpi(value); - break; - - case 'aspect-ratio': - case 'device-aspect-ratio': - case /* Deprecated */ 'device-pixel-ratio': - expValue = toDecimal(expValue); - value = toDecimal(value); - break; - - case 'grid': - case 'color': - case 'color-index': - case 'monochrome': - expValue = parseInt(expValue, 10) || 1; - value = parseInt(value, 10) || 0; - break; - } - - switch (modifier) { - case 'min': return value >= expValue; - case 'max': return value <= expValue; - default : return value === expValue; - } - }); - - return (expressionsMatch && !inverse) || (!expressionsMatch && inverse); - }); -} - -function parseQuery(mediaQuery) { - return mediaQuery.split(',').map(function (query) { - query = query.trim(); - - var captures = query.match(RE_MEDIA_QUERY), - modifier = captures[1], - type = captures[2], - expressions = captures[3] || '', - parsed = {}; - - parsed.inverse = !!modifier && modifier.toLowerCase() === 'not'; - parsed.type = type ? type.toLowerCase() : 'all'; - - // Split expressions into a list. - expressions = expressions.match(/\([^\)]+\)/g) || []; - - parsed.expressions = expressions.map(function (expression) { - var captures = expression.match(RE_MQ_EXPRESSION), - feature = captures[1].toLowerCase().match(RE_MQ_FEATURE); - - return { - modifier: feature[1], - feature : feature[2], - value : captures[2] - }; - }); - - return parsed; - }); -} - -// -- Utilities ---------------------------------------------------------------- - -function toDecimal(ratio) { - var decimal = Number(ratio), - numbers; - - if (!decimal) { - numbers = ratio.match(/^(\d+)\s*\/\s*(\d+)$/); - decimal = numbers[1] / numbers[2]; - } - - return decimal; -} - -function toDpi(resolution) { - var value = parseFloat(resolution), - units = String(resolution).match(RE_RESOLUTION_UNIT)[1]; - - switch (units) { - case 'dpcm': return value / 2.54; - case 'dppx': return value * 96; - default : return value; - } -} - -function toPx(length) { - var value = parseFloat(length), - units = String(length).match(RE_LENGTH_UNIT)[1]; - - switch (units) { - case 'em' : return value * 16; - case 'rem': return value * 16; - case 'cm' : return value * 96 / 2.54; - case 'mm' : return value * 96 / 2.54 / 10; - case 'in' : return value * 96; - case 'pt' : return value * 72; - case 'pc' : return value * 72 / 12; - default : return value; - } -} - - -/***/ }), - -/***/ "7fqt": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["wordcount"]; }()); - -/***/ }), - -/***/ "8OQS": -/***/ (function(module, exports) { - -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; -} - -module.exports = _objectWithoutPropertiesLoose; -module.exports["default"] = module.exports, module.exports.__esModule = true; - -/***/ }), - -/***/ "9Do8": -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -module.exports = __webpack_require__("zt9T"); - -/***/ }), - -/***/ "B9Az": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; - -// EXTERNAL MODULE: external ["wp","element"] -var external_wp_element_ = __webpack_require__("GRId"); - -// EXTERNAL MODULE: external ["wp","primitives"] -var external_wp_primitives_ = __webpack_require__("Tqx9"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pencil.js - - -/** - * WordPress dependencies - */ - -const pencil = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { - d: "M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z" -})); -/* harmony default export */ var library_pencil = (pencil); - -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js -/** - * Internal dependencies - */ - -/* harmony default export */ var edit = __webpack_exports__["a"] = (library_pencil); - - -/***/ }), - -/***/ "BLeD": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["tokenList"]; }()); - -/***/ }), - -/***/ "Bpkj": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const link = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M15.6 7.2H14v1.5h1.6c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.8 0 5.2-2.3 5.2-5.2 0-2.9-2.3-5.2-5.2-5.2zM4.7 12.4c0-2 1.7-3.7 3.7-3.7H10V7.2H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H10v-1.5H8.4c-2 0-3.7-1.7-3.7-3.7zm4.6.9h5.3v-1.5H9.3v1.5z" -})); -/* harmony default export */ __webpack_exports__["a"] = (link); - - -/***/ }), - -/***/ "CNgt": -/***/ (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__("cDcd"); -var PropTypes = __webpack_require__("17x9"); -var autosize = __webpack_require__("GemG"); -var _getLineHeight = __webpack_require__("Rk8H"); -var getLineHeight = _getLineHeight; -var RESIZED = "autosize:resized"; -/** - * A light replacement for built-in textarea component - * which automaticaly adjusts its height to match the content - */ -var TextareaAutosizeClass = /** @class */ (function (_super) { - __extends(TextareaAutosizeClass, _super); - function TextareaAutosizeClass() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.state = { - lineHeight: null - }; - _this.textarea = null; - _this.onResize = function (e) { - if (_this.props.onResize) { - _this.props.onResize(e); - } - }; - _this.updateLineHeight = function () { - if (_this.textarea) { - _this.setState({ - lineHeight: getLineHeight(_this.textarea) - }); - } - }; - _this.onChange = function (e) { - var onChange = _this.props.onChange; - _this.currentValue = e.currentTarget.value; - onChange && onChange(e); - }; - return _this; - } - TextareaAutosizeClass.prototype.componentDidMount = function () { - var _this = this; - var _a = this.props, maxRows = _a.maxRows, async = _a.async; - if (typeof maxRows === "number") { - this.updateLineHeight(); - } - if (typeof maxRows === "number" || async) { - /* - the defer is needed to: - - force "autosize" to activate the scrollbar when this.props.maxRows is passed - - support StyledComponents (see #71) - */ - setTimeout(function () { return _this.textarea && autosize(_this.textarea); }); - } - else { - this.textarea && autosize(this.textarea); - } - if (this.textarea) { - this.textarea.addEventListener(RESIZED, this.onResize); - } - }; - TextareaAutosizeClass.prototype.componentWillUnmount = function () { - if (this.textarea) { - this.textarea.removeEventListener(RESIZED, this.onResize); - autosize.destroy(this.textarea); - } - }; - TextareaAutosizeClass.prototype.render = function () { - var _this = this; - var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight; - var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null; - return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) { - _this.textarea = element; - if (typeof _this.props.innerRef === 'function') { - _this.props.innerRef(element); - } - else if (_this.props.innerRef) { - _this.props.innerRef.current = element; - } - } }), children)); - }; - TextareaAutosizeClass.prototype.componentDidUpdate = function () { - this.textarea && autosize.update(this.textarea); - }; - TextareaAutosizeClass.defaultProps = { - rows: 1, - async: false - }; - TextareaAutosizeClass.propTypes = { - rows: PropTypes.number, - maxRows: PropTypes.number, - onResize: PropTypes.func, - innerRef: PropTypes.any, - async: PropTypes.bool - }; - return TextareaAutosizeClass; -}(React.Component)); -exports.TextareaAutosize = React.forwardRef(function (props, ref) { - return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref })); -}); - - -/***/ }), - -/***/ "Civd": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const layout = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" -})); -/* harmony default export */ __webpack_exports__["a"] = (layout); - - -/***/ }), - -/***/ "Crq9": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const formatStrikethrough = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M9.1 9v-.5c0-.6.2-1.1.7-1.4.5-.3 1.2-.5 2-.5.7 0 1.4.1 2.1.3.7.2 1.4.5 2.1.9l.2-1.9c-.6-.3-1.2-.5-1.9-.7-.8-.1-1.6-.2-2.4-.2-1.5 0-2.7.3-3.6 1-.8.7-1.2 1.5-1.2 2.6V9h2zM20 12H4v1h8.3c.3.1.6.2.8.3.5.2.9.5 1.1.8.3.3.4.7.4 1.2 0 .7-.2 1.1-.8 1.5-.5.3-1.2.5-2.1.5-.8 0-1.6-.1-2.4-.3-.8-.2-1.5-.5-2.2-.8L7 18.1c.5.2 1.2.4 2 .6.8.2 1.6.3 2.4.3 1.7 0 3-.3 3.9-1 .9-.7 1.3-1.6 1.3-2.8 0-.9-.2-1.7-.7-2.2H20v-1z" -})); -/* harmony default export */ __webpack_exports__["a"] = (formatStrikethrough); - - -/***/ }), - -/***/ "GRId": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["element"]; }()); - -/***/ }), - -/***/ "GemG": -/***/ (function(module, exports, __webpack_require__) { - var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! autosize 4.0.4 license: MIT @@ -910,9 +12,9 @@ (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__)); + __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'; @@ -1188,360 +290,9 @@ /***/ }), -/***/ "HSyU": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["blocks"]; }()); - -/***/ }), - -/***/ "K9lf": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["compose"]; }()); - -/***/ }), - -/***/ "Mmq9": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["url"]; }()); - -/***/ }), - -/***/ "NMb1": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["deprecated"]; }()); - -/***/ }), - -/***/ "NTP4": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const upload = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z" -})); -/* harmony default export */ __webpack_exports__["a"] = (upload); - - -/***/ }), - -/***/ "NWDH": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const chevronDown = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" -})); -/* harmony default export */ __webpack_exports__["a"] = (chevronDown); - - -/***/ }), - -/***/ "O6Fj": -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -exports.__esModule = true; -var TextareaAutosize_1 = __webpack_require__("CNgt"); -exports["default"] = TextareaAutosize_1.TextareaAutosize; - - -/***/ }), - -/***/ "OzlF": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const listView = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z" -})); -/* harmony default export */ __webpack_exports__["a"] = (listView); - - -/***/ }), - -/***/ "P7XM": -/***/ (function(module, exports) { - -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - if (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) { - if (superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } - } -} - - -/***/ }), - -/***/ "PJYZ": +/***/ 4403: /***/ (function(module, exports) { -function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - - return self; -} - -module.exports = _assertThisInitialized; -module.exports["default"] = module.exports, module.exports.__esModule = true; - -/***/ }), - -/***/ "Q4Sy": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const plus = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z" -})); -/* harmony default export */ __webpack_exports__["a"] = (plus); - - -/***/ }), - -/***/ "RMJe": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const check = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z" -})); -/* harmony default export */ __webpack_exports__["a"] = (check); - - -/***/ }), - -/***/ "Rk8H": -/***/ (function(module, exports, __webpack_require__) { - -// Load in dependencies -var computedStyle = __webpack_require__("jTPX"); - -/** - * 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; - - -/***/ }), - -/***/ "RxS6": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["keycodes"]; }()); - -/***/ }), - -/***/ "SVSp": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["shortcode"]; }()); - -/***/ }), - -/***/ "SksO": -/***/ (function(module, exports) { - -function _setPrototypeOf(o, p) { - module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - module.exports["default"] = module.exports, module.exports.__esModule = true; - return _setPrototypeOf(o, p); -} - -module.exports = _setPrototypeOf; -module.exports["default"] = module.exports, module.exports.__esModule = true; - -/***/ }), - -/***/ "TSYQ": -/***/ (function(module, exports, __webpack_require__) { - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see @@ -1596,4677 +347,15 @@ !(__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__)); + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else {} }()); /***/ }), -/***/ "Tqx9": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["primitives"]; }()); - -/***/ }), - -/***/ "VKE3": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const moreVertical = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" -})); -/* harmony default export */ __webpack_exports__["a"] = (moreVertical); - - -/***/ }), - -/***/ "VbXa": -/***/ (function(module, exports, __webpack_require__) { - -var setPrototypeOf = __webpack_require__("SksO"); - -function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - setPrototypeOf(subClass, superClass); -} - -module.exports = _inheritsLoose; -module.exports["default"] = module.exports, module.exports.__esModule = true; - -/***/ }), - -/***/ "WbBG": -/***/ (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; - - -/***/ }), - -/***/ "XgzB": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const chevronUp = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" -})); -/* harmony default export */ __webpack_exports__["a"] = (chevronUp); - - -/***/ }), - -/***/ "YLtl": -/***/ (function(module, exports) { - -(function() { module.exports = window["lodash"]; }()); - -/***/ }), - -/***/ "ZO3Q": -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, '__esModule', { value: true }); - -function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } - -var _extends = _interopDefault(__webpack_require__("pVnL")); -var _objectWithoutPropertiesLoose = _interopDefault(__webpack_require__("8OQS")); -var React = __webpack_require__("cDcd"); -var React__default = _interopDefault(React); -var _inheritsLoose = _interopDefault(__webpack_require__("VbXa")); -var _assertThisInitialized = _interopDefault(__webpack_require__("PJYZ")); - -var is = { - arr: Array.isArray, - obj: function obj(a) { - return Object.prototype.toString.call(a) === '[object Object]'; - }, - fun: function fun(a) { - return typeof a === 'function'; - }, - str: function str(a) { - return typeof a === 'string'; - }, - num: function num(a) { - return typeof a === 'number'; - }, - und: function und(a) { - return a === void 0; - }, - nul: function nul(a) { - return a === null; - }, - set: function set(a) { - return a instanceof Set; - }, - map: function map(a) { - return a instanceof Map; - }, - equ: function equ(a, b) { - if (typeof a !== typeof b) return false; - if (is.str(a) || is.num(a)) return a === b; - if (is.obj(a) && is.obj(b) && Object.keys(a).length + Object.keys(b).length === 0) return true; - var i; - - for (i in a) { - if (!(i in b)) return false; - } - - for (i in b) { - if (a[i] !== b[i]) return false; - } - - return is.und(i) ? a === b : true; - } -}; -function merge(target, lowercase) { - if (lowercase === void 0) { - lowercase = true; - } - - return function (object) { - return (is.arr(object) ? object : Object.keys(object)).reduce(function (acc, element) { - var key = lowercase ? element[0].toLowerCase() + element.substring(1) : element; - acc[key] = target(key); - return acc; - }, target); - }; -} -function useForceUpdate() { - var _useState = React.useState(false), - f = _useState[1]; - - var forceUpdate = React.useCallback(function () { - return f(function (v) { - return !v; - }); - }, []); - return forceUpdate; -} -function withDefault(value, defaultValue) { - return is.und(value) || is.nul(value) ? defaultValue : value; -} -function toArray(a) { - return !is.und(a) ? is.arr(a) ? a : [a] : []; -} -function callProp(obj) { - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - return is.fun(obj) ? obj.apply(void 0, args) : obj; -} - -function getForwardProps(props) { - var to = props.to, - from = props.from, - config = props.config, - onStart = props.onStart, - onRest = props.onRest, - onFrame = props.onFrame, - children = props.children, - reset = props.reset, - reverse = props.reverse, - force = props.force, - immediate = props.immediate, - delay = props.delay, - attach = props.attach, - destroyed = props.destroyed, - interpolateTo = props.interpolateTo, - ref = props.ref, - lazy = props.lazy, - forward = _objectWithoutPropertiesLoose(props, ["to", "from", "config", "onStart", "onRest", "onFrame", "children", "reset", "reverse", "force", "immediate", "delay", "attach", "destroyed", "interpolateTo", "ref", "lazy"]); - - return forward; -} - -function interpolateTo(props) { - var forward = getForwardProps(props); - if (is.und(forward)) return _extends({ - to: forward - }, props); - var rest = Object.keys(props).reduce(function (a, k) { - var _extends2; - - return !is.und(forward[k]) ? a : _extends({}, a, (_extends2 = {}, _extends2[k] = props[k], _extends2)); - }, {}); - return _extends({ - to: forward - }, rest); -} -function handleRef(ref, forward) { - if (forward) { - // If it's a function, assume it's a ref callback - if (is.fun(forward)) forward(ref);else if (is.obj(forward)) { - forward.current = ref; - } - } - - return ref; -} - -var Animated = -/*#__PURE__*/ -function () { - function Animated() { - this.payload = void 0; - this.children = []; - } - - var _proto = Animated.prototype; - - _proto.getAnimatedValue = function getAnimatedValue() { - return this.getValue(); - }; - - _proto.getPayload = function getPayload() { - return this.payload || this; - }; - - _proto.attach = function attach() {}; - - _proto.detach = function detach() {}; - - _proto.getChildren = function getChildren() { - return this.children; - }; - - _proto.addChild = function addChild(child) { - if (this.children.length === 0) this.attach(); - this.children.push(child); - }; - - _proto.removeChild = function removeChild(child) { - var index = this.children.indexOf(child); - this.children.splice(index, 1); - if (this.children.length === 0) this.detach(); - }; - - return Animated; -}(); -var AnimatedArray = -/*#__PURE__*/ -function (_Animated) { - _inheritsLoose(AnimatedArray, _Animated); - - function AnimatedArray() { - var _this; - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - _this = _Animated.call.apply(_Animated, [this].concat(args)) || this; - _this.payload = []; - - _this.attach = function () { - return _this.payload.forEach(function (p) { - return p instanceof Animated && p.addChild(_assertThisInitialized(_this)); - }); - }; - - _this.detach = function () { - return _this.payload.forEach(function (p) { - return p instanceof Animated && p.removeChild(_assertThisInitialized(_this)); - }); - }; - - return _this; - } - - return AnimatedArray; -}(Animated); -var AnimatedObject = -/*#__PURE__*/ -function (_Animated2) { - _inheritsLoose(AnimatedObject, _Animated2); - - function AnimatedObject() { - var _this2; - - for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - args[_key3] = arguments[_key3]; - } - - _this2 = _Animated2.call.apply(_Animated2, [this].concat(args)) || this; - _this2.payload = {}; - - _this2.attach = function () { - return Object.values(_this2.payload).forEach(function (s) { - return s instanceof Animated && s.addChild(_assertThisInitialized(_this2)); - }); - }; - - _this2.detach = function () { - return Object.values(_this2.payload).forEach(function (s) { - return s instanceof Animated && s.removeChild(_assertThisInitialized(_this2)); - }); - }; - - return _this2; - } - - var _proto2 = AnimatedObject.prototype; - - _proto2.getValue = function getValue(animated) { - if (animated === void 0) { - animated = false; - } - - var payload = {}; - - for (var _key4 in this.payload) { - var value = this.payload[_key4]; - if (animated && !(value instanceof Animated)) continue; - payload[_key4] = value instanceof Animated ? value[animated ? 'getAnimatedValue' : 'getValue']() : value; - } - - return payload; - }; - - _proto2.getAnimatedValue = function getAnimatedValue() { - return this.getValue(true); - }; - - return AnimatedObject; -}(Animated); - -var applyAnimatedValues; -function injectApplyAnimatedValues(fn, transform) { - applyAnimatedValues = { - fn: fn, - transform: transform - }; -} -var colorNames; -function injectColorNames(names) { - colorNames = names; -} -var requestFrame = function requestFrame(cb) { - return typeof window !== 'undefined' ? window.requestAnimationFrame(cb) : -1; -}; -var cancelFrame = function cancelFrame(id) { - typeof window !== 'undefined' && window.cancelAnimationFrame(id); -}; -function injectFrame(raf, caf) { - requestFrame = raf; - cancelFrame = caf; -} -var interpolation; -function injectStringInterpolator(fn) { - interpolation = fn; -} -var now = function now() { - return Date.now(); -}; -function injectNow(nowFn) { - now = nowFn; -} -var defaultElement; -function injectDefaultElement(el) { - defaultElement = el; -} -var animatedApi = function animatedApi(node) { - return node.current; -}; -function injectAnimatedApi(fn) { - animatedApi = fn; -} -var createAnimatedStyle; -function injectCreateAnimatedStyle(factory) { - createAnimatedStyle = factory; -} -var manualFrameloop; -function injectManualFrameloop(callback) { - manualFrameloop = callback; -} - -var Globals = /*#__PURE__*/Object.freeze({ - get applyAnimatedValues () { return applyAnimatedValues; }, - injectApplyAnimatedValues: injectApplyAnimatedValues, - get colorNames () { return colorNames; }, - injectColorNames: injectColorNames, - get requestFrame () { return requestFrame; }, - get cancelFrame () { return cancelFrame; }, - injectFrame: injectFrame, - get interpolation () { return interpolation; }, - injectStringInterpolator: injectStringInterpolator, - get now () { return now; }, - injectNow: injectNow, - get defaultElement () { return defaultElement; }, - injectDefaultElement: injectDefaultElement, - get animatedApi () { return animatedApi; }, - injectAnimatedApi: injectAnimatedApi, - get createAnimatedStyle () { return createAnimatedStyle; }, - injectCreateAnimatedStyle: injectCreateAnimatedStyle, - get manualFrameloop () { return manualFrameloop; }, - injectManualFrameloop: injectManualFrameloop -}); - -/** - * Wraps the `style` property with `AnimatedStyle`. - */ - -var AnimatedProps = -/*#__PURE__*/ -function (_AnimatedObject) { - _inheritsLoose(AnimatedProps, _AnimatedObject); - - function AnimatedProps(props, callback) { - var _this; - - _this = _AnimatedObject.call(this) || this; - _this.update = void 0; - _this.payload = !props.style ? props : _extends({}, props, { - style: createAnimatedStyle(props.style) - }); - _this.update = callback; - - _this.attach(); - - return _this; - } - - return AnimatedProps; -}(AnimatedObject); - -var isFunctionComponent = function isFunctionComponent(val) { - return is.fun(val) && !(val.prototype instanceof React__default.Component); -}; - -var createAnimatedComponent = function createAnimatedComponent(Component) { - var AnimatedComponent = React.forwardRef(function (props, ref) { - var forceUpdate = useForceUpdate(); - var mounted = React.useRef(true); - var propsAnimated = React.useRef(null); - var node = React.useRef(null); - var attachProps = React.useCallback(function (props) { - var oldPropsAnimated = propsAnimated.current; - - var callback = function callback() { - var didUpdate = false; - - if (node.current) { - didUpdate = applyAnimatedValues.fn(node.current, propsAnimated.current.getAnimatedValue()); - } - - if (!node.current || didUpdate === false) { - // If no referenced node has been found, or the update target didn't have a - // native-responder, then forceUpdate the animation ... - forceUpdate(); - } - }; - - propsAnimated.current = new AnimatedProps(props, callback); - oldPropsAnimated && oldPropsAnimated.detach(); - }, []); - React.useEffect(function () { - return function () { - mounted.current = false; - propsAnimated.current && propsAnimated.current.detach(); - }; - }, []); - React.useImperativeHandle(ref, function () { - return animatedApi(node, mounted, forceUpdate); - }); - attachProps(props); - - var _getValue = propsAnimated.current.getValue(), - scrollTop = _getValue.scrollTop, - scrollLeft = _getValue.scrollLeft, - animatedProps = _objectWithoutPropertiesLoose(_getValue, ["scrollTop", "scrollLeft"]); // Functions cannot have refs, see: - // See: https://github.com/react-spring/react-spring/issues/569 - - - var refFn = isFunctionComponent(Component) ? undefined : function (childRef) { - return node.current = handleRef(childRef, ref); - }; - return React__default.createElement(Component, _extends({}, animatedProps, { - ref: refFn - })); - }); - return AnimatedComponent; -}; - -var active = false; -var controllers = new Set(); - -var update = function update() { - if (!active) return false; - var time = now(); - - for (var _iterator = controllers, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } - - var controller = _ref; - var isActive = false; - - for (var configIdx = 0; configIdx < controller.configs.length; configIdx++) { - var config = controller.configs[configIdx]; - var endOfAnimation = void 0, - lastTime = void 0; - - for (var valIdx = 0; valIdx < config.animatedValues.length; valIdx++) { - var animation = config.animatedValues[valIdx]; // If an animation is done, skip, until all of them conclude - - if (animation.done) continue; - var from = config.fromValues[valIdx]; - var to = config.toValues[valIdx]; - var position = animation.lastPosition; - var isAnimated = to instanceof Animated; - var velocity = Array.isArray(config.initialVelocity) ? config.initialVelocity[valIdx] : config.initialVelocity; - if (isAnimated) to = to.getValue(); // Conclude animation if it's either immediate, or from-values match end-state - - if (config.immediate) { - animation.setValue(to); - animation.done = true; - continue; - } // Break animation when string values are involved - - - if (typeof from === 'string' || typeof to === 'string') { - animation.setValue(to); - animation.done = true; - continue; - } - - if (config.duration !== void 0) { - /** Duration easing */ - position = from + config.easing((time - animation.startTime) / config.duration) * (to - from); - endOfAnimation = time >= animation.startTime + config.duration; - } else if (config.decay) { - /** Decay easing */ - position = from + velocity / (1 - 0.998) * (1 - Math.exp(-(1 - 0.998) * (time - animation.startTime))); - endOfAnimation = Math.abs(animation.lastPosition - position) < 0.1; - if (endOfAnimation) to = position; - } else { - /** Spring easing */ - lastTime = animation.lastTime !== void 0 ? animation.lastTime : time; - velocity = animation.lastVelocity !== void 0 ? animation.lastVelocity : config.initialVelocity; // If we lost a lot of frames just jump to the end. - - if (time > lastTime + 64) lastTime = time; // http://gafferongames.com/game-physics/fix-your-timestep/ - - var numSteps = Math.floor(time - lastTime); - - for (var i = 0; i < numSteps; ++i) { - var force = -config.tension * (position - to); - var damping = -config.friction * velocity; - var acceleration = (force + damping) / config.mass; - velocity = velocity + acceleration * 1 / 1000; - position = position + velocity * 1 / 1000; - } // Conditions for stopping the spring animation - - - var isOvershooting = config.clamp && config.tension !== 0 ? from < to ? position > to : position < to : false; - var isVelocity = Math.abs(velocity) <= config.precision; - var isDisplacement = config.tension !== 0 ? Math.abs(to - position) <= config.precision : true; - endOfAnimation = isOvershooting || isVelocity && isDisplacement; - animation.lastVelocity = velocity; - animation.lastTime = time; - } // Trails aren't done until their parents conclude - - - if (isAnimated && !config.toValues[valIdx].done) endOfAnimation = false; - - if (endOfAnimation) { - // Ensure that we end up with a round value - if (animation.value !== to) position = to; - animation.done = true; - } else isActive = true; - - animation.setValue(position); - animation.lastPosition = position; - } // Keep track of updated values only when necessary - - - if (controller.props.onFrame) controller.values[config.name] = config.interpolation.getValue(); - } // Update callbacks in the end of the frame - - - if (controller.props.onFrame) controller.props.onFrame(controller.values); // Either call onEnd or next frame - - if (!isActive) { - controllers.delete(controller); - controller.stop(true); - } - } // Loop over as long as there are controllers ... - - - if (controllers.size) { - if (manualFrameloop) manualFrameloop();else requestFrame(update); - } else { - active = false; - } - - return active; -}; - -var start = function start(controller) { - if (!controllers.has(controller)) controllers.add(controller); - - if (!active) { - active = true; - if (manualFrameloop) requestFrame(manualFrameloop);else requestFrame(update); - } -}; - -var stop = function stop(controller) { - if (controllers.has(controller)) controllers.delete(controller); -}; - -function createInterpolator(range, output, extrapolate) { - if (typeof range === 'function') { - return range; - } - - if (Array.isArray(range)) { - return createInterpolator({ - range: range, - output: output, - extrapolate: extrapolate - }); - } - - if (interpolation && typeof range.output[0] === 'string') { - return interpolation(range); - } - - var config = range; - var outputRange = config.output; - var inputRange = config.range || [0, 1]; - var extrapolateLeft = config.extrapolateLeft || config.extrapolate || 'extend'; - var extrapolateRight = config.extrapolateRight || config.extrapolate || 'extend'; - - var easing = config.easing || function (t) { - return t; - }; - - return function (input) { - var range = findRange(input, inputRange); - return interpolate(input, inputRange[range], inputRange[range + 1], outputRange[range], outputRange[range + 1], easing, extrapolateLeft, extrapolateRight, config.map); - }; -} - -function interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) { - var result = map ? map(input) : input; // Extrapolate - - if (result < inputMin) { - if (extrapolateLeft === 'identity') return result;else if (extrapolateLeft === 'clamp') result = inputMin; - } - - if (result > inputMax) { - if (extrapolateRight === 'identity') return result;else if (extrapolateRight === 'clamp') result = inputMax; - } - - if (outputMin === outputMax) return outputMin; - if (inputMin === inputMax) return input <= inputMin ? outputMin : outputMax; // Input Range - - if (inputMin === -Infinity) result = -result;else if (inputMax === Infinity) result = result - inputMin;else result = (result - inputMin) / (inputMax - inputMin); // Easing - - result = easing(result); // Output Range - - if (outputMin === -Infinity) result = -result;else if (outputMax === Infinity) result = result + outputMin;else result = result * (outputMax - outputMin) + outputMin; - return result; -} - -function findRange(input, inputRange) { - for (var i = 1; i < inputRange.length - 1; ++i) { - if (inputRange[i] >= input) break; - } - - return i - 1; -} - -var AnimatedInterpolation = -/*#__PURE__*/ -function (_AnimatedArray) { - _inheritsLoose(AnimatedInterpolation, _AnimatedArray); - - function AnimatedInterpolation(parents, range, output, extrapolate) { - var _this; - - _this = _AnimatedArray.call(this) || this; - _this.calc = void 0; - _this.payload = parents instanceof AnimatedArray && !(parents instanceof AnimatedInterpolation) ? parents.getPayload() : Array.isArray(parents) ? parents : [parents]; - _this.calc = createInterpolator(range, output, extrapolate); - return _this; - } - - var _proto = AnimatedInterpolation.prototype; - - _proto.getValue = function getValue() { - return this.calc.apply(this, this.payload.map(function (value) { - return value.getValue(); - })); - }; - - _proto.updateConfig = function updateConfig(range, output, extrapolate) { - this.calc = createInterpolator(range, output, extrapolate); - }; - - _proto.interpolate = function interpolate(range, output, extrapolate) { - return new AnimatedInterpolation(this, range, output, extrapolate); - }; - - return AnimatedInterpolation; -}(AnimatedArray); - -var interpolate$1 = function interpolate(parents, range, output) { - return parents && new AnimatedInterpolation(parents, range, output); -}; - -var config = { - default: { - tension: 170, - friction: 26 - }, - gentle: { - tension: 120, - friction: 14 - }, - wobbly: { - tension: 180, - friction: 12 - }, - stiff: { - tension: 210, - friction: 20 - }, - slow: { - tension: 280, - friction: 60 - }, - molasses: { - tension: 280, - friction: 120 - } -}; - -/** API - * useChain(references, timeSteps, timeFrame) - */ - -function useChain(refs, timeSteps, timeFrame) { - if (timeFrame === void 0) { - timeFrame = 1000; - } - - var previous = React.useRef(); - React.useEffect(function () { - if (is.equ(refs, previous.current)) refs.forEach(function (_ref) { - var current = _ref.current; - return current && current.start(); - });else if (timeSteps) { - refs.forEach(function (_ref2, index) { - var current = _ref2.current; - - if (current) { - var ctrls = current.controllers; - - if (ctrls.length) { - var t = timeFrame * timeSteps[index]; - ctrls.forEach(function (ctrl) { - ctrl.queue = ctrl.queue.map(function (e) { - return _extends({}, e, { - delay: e.delay + t - }); - }); - ctrl.start(); - }); - } - } - }); - } else refs.reduce(function (q, _ref3, rI) { - var current = _ref3.current; - return q = q.then(function () { - return current.start(); - }); - }, Promise.resolve()); - previous.current = refs; - }); -} - -/** - * Animated works by building a directed acyclic graph of dependencies - * transparently when you render your Animated components. - * - * new Animated.Value(0) - * .interpolate() .interpolate() new Animated.Value(1) - * opacity translateY scale - * style transform - * View#234 style - * View#123 - * - * A) Top Down phase - * When an AnimatedValue is updated, we recursively go down through this - * graph in order to find leaf nodes: the views that we flag as needing - * an update. - * - * B) Bottom Up phase - * When a view is flagged as needing an update, we recursively go back up - * in order to build the new value that it needs. The reason why we need - * this two-phases process is to deal with composite props such as - * transform which can receive values from multiple parents. - */ -function addAnimatedStyles(node, styles) { - if ('update' in node) { - styles.add(node); - } else { - node.getChildren().forEach(function (child) { - return addAnimatedStyles(child, styles); - }); - } -} - -var AnimatedValue = -/*#__PURE__*/ -function (_Animated) { - _inheritsLoose(AnimatedValue, _Animated); - - function AnimatedValue(_value) { - var _this; - - _this = _Animated.call(this) || this; - _this.animatedStyles = new Set(); - _this.value = void 0; - _this.startPosition = void 0; - _this.lastPosition = void 0; - _this.lastVelocity = void 0; - _this.startTime = void 0; - _this.lastTime = void 0; - _this.done = false; - - _this.setValue = function (value, flush) { - if (flush === void 0) { - flush = true; - } - - _this.value = value; - if (flush) _this.flush(); - }; - - _this.value = _value; - _this.startPosition = _value; - _this.lastPosition = _value; - return _this; - } - - var _proto = AnimatedValue.prototype; - - _proto.flush = function flush() { - if (this.animatedStyles.size === 0) { - addAnimatedStyles(this, this.animatedStyles); - } - - this.animatedStyles.forEach(function (animatedStyle) { - return animatedStyle.update(); - }); - }; - - _proto.clearStyles = function clearStyles() { - this.animatedStyles.clear(); - }; - - _proto.getValue = function getValue() { - return this.value; - }; - - _proto.interpolate = function interpolate(range, output, extrapolate) { - return new AnimatedInterpolation(this, range, output, extrapolate); - }; - - return AnimatedValue; -}(Animated); - -var AnimatedValueArray = -/*#__PURE__*/ -function (_AnimatedArray) { - _inheritsLoose(AnimatedValueArray, _AnimatedArray); - - function AnimatedValueArray(values) { - var _this; - - _this = _AnimatedArray.call(this) || this; - _this.payload = values.map(function (n) { - return new AnimatedValue(n); - }); - return _this; - } - - var _proto = AnimatedValueArray.prototype; - - _proto.setValue = function setValue(value, flush) { - var _this2 = this; - - if (flush === void 0) { - flush = true; - } - - if (Array.isArray(value)) { - if (value.length === this.payload.length) { - value.forEach(function (v, i) { - return _this2.payload[i].setValue(v, flush); - }); - } - } else { - this.payload.forEach(function (p) { - return p.setValue(value, flush); - }); - } - }; - - _proto.getValue = function getValue() { - return this.payload.map(function (v) { - return v.getValue(); - }); - }; - - _proto.interpolate = function interpolate(range, output) { - return new AnimatedInterpolation(this, range, output); - }; - - return AnimatedValueArray; -}(AnimatedArray); - -var G = 0; - -var Controller = -/*#__PURE__*/ -function () { - function Controller() { - var _this = this; - - this.id = void 0; - this.idle = true; - this.hasChanged = false; - this.guid = 0; - this.local = 0; - this.props = {}; - this.merged = {}; - this.animations = {}; - this.interpolations = {}; - this.values = {}; - this.configs = []; - this.listeners = []; - this.queue = []; - this.localQueue = void 0; - - this.getValues = function () { - return _this.interpolations; - }; - - this.id = G++; - } - /** update(props) - * This function filters input props and creates an array of tasks which are executed in .start() - * Each task is allowed to carry a delay, which means it can execute asnychroneously */ - - - var _proto = Controller.prototype; - - _proto.update = function update$$1(args) { - //this._id = n + this.id - if (!args) return this; // Extract delay and the to-prop from props - - var _ref = interpolateTo(args), - _ref$delay = _ref.delay, - delay = _ref$delay === void 0 ? 0 : _ref$delay, - to = _ref.to, - props = _objectWithoutPropertiesLoose(_ref, ["delay", "to"]); - - if (is.arr(to) || is.fun(to)) { - // If config is either a function or an array queue it up as is - this.queue.push(_extends({}, props, { - delay: delay, - to: to - })); - } else if (to) { - // Otherwise go through each key since it could be delayed individually - var ops = {}; - Object.entries(to).forEach(function (_ref2) { - var _to; - - var k = _ref2[0], - v = _ref2[1]; - - // Fetch delay and create an entry, consisting of the to-props, the delay, and basic props - var entry = _extends({ - to: (_to = {}, _to[k] = v, _to), - delay: callProp(delay, k) - }, props); - - var previous = ops[entry.delay] && ops[entry.delay].to; - ops[entry.delay] = _extends({}, ops[entry.delay], entry, { - to: _extends({}, previous, entry.to) - }); - }); - this.queue = Object.values(ops); - } // Sort queue, so that async calls go last - - - this.queue = this.queue.sort(function (a, b) { - return a.delay - b.delay; - }); // Diff the reduced props immediately (they'll contain the from-prop and some config) - - this.diff(props); - return this; - } - /** start(onEnd) - * This function either executes a queue, if present, or starts the frameloop, which animates */ - ; - - _proto.start = function start$$1(onEnd) { - var _this2 = this; - - // If a queue is present we must excecute it - if (this.queue.length) { - this.idle = false; // Updates can interrupt trailing queues, in that case we just merge values - - if (this.localQueue) { - this.localQueue.forEach(function (_ref3) { - var _ref3$from = _ref3.from, - from = _ref3$from === void 0 ? {} : _ref3$from, - _ref3$to = _ref3.to, - to = _ref3$to === void 0 ? {} : _ref3$to; - if (is.obj(from)) _this2.merged = _extends({}, from, _this2.merged); - if (is.obj(to)) _this2.merged = _extends({}, _this2.merged, to); - }); - } // The guid helps us tracking frames, a new queue over an old one means an override - // We discard async calls in that caseÍ - - - var local = this.local = ++this.guid; - var queue = this.localQueue = this.queue; - this.queue = []; // Go through each entry and execute it - - queue.forEach(function (_ref4, index) { - var delay = _ref4.delay, - props = _objectWithoutPropertiesLoose(_ref4, ["delay"]); - - var cb = function cb(finished) { - if (index === queue.length - 1 && local === _this2.guid && finished) { - _this2.idle = true; - if (_this2.props.onRest) _this2.props.onRest(_this2.merged); - } - - if (onEnd) onEnd(); - }; // Entries can be delayed, ansyc or immediate - - - var async = is.arr(props.to) || is.fun(props.to); - - if (delay) { - setTimeout(function () { - if (local === _this2.guid) { - if (async) _this2.runAsync(props, cb);else _this2.diff(props).start(cb); - } - }, delay); - } else if (async) _this2.runAsync(props, cb);else _this2.diff(props).start(cb); - }); - } // Otherwise we kick of the frameloop - else { - if (is.fun(onEnd)) this.listeners.push(onEnd); - if (this.props.onStart) this.props.onStart(); - - start(this); - } - - return this; - }; - - _proto.stop = function stop$$1(finished) { - this.listeners.forEach(function (onEnd) { - return onEnd(finished); - }); - this.listeners = []; - return this; - } - /** Pause sets onEnd listeners free, but also removes the controller from the frameloop */ - ; - - _proto.pause = function pause(finished) { - this.stop(true); - if (finished) stop(this); - return this; - }; - - _proto.runAsync = function runAsync(_ref5, onEnd) { - var _this3 = this; - - var delay = _ref5.delay, - props = _objectWithoutPropertiesLoose(_ref5, ["delay"]); - - var local = this.local; // If "to" is either a function or an array it will be processed async, therefor "to" should be empty right now - // If the view relies on certain values "from" has to be present - - var queue = Promise.resolve(undefined); - - if (is.arr(props.to)) { - var _loop = function _loop(i) { - var index = i; - - var fresh = _extends({}, props, interpolateTo(props.to[index])); - - if (is.arr(fresh.config)) fresh.config = fresh.config[index]; - queue = queue.then(function () { - //this.stop() - if (local === _this3.guid) return new Promise(function (r) { - return _this3.diff(fresh).start(r); - }); - }); - }; - - for (var i = 0; i < props.to.length; i++) { - _loop(i); - } - } else if (is.fun(props.to)) { - var index = 0; - var last; - queue = queue.then(function () { - return props.to( // next(props) - function (p) { - var fresh = _extends({}, props, interpolateTo(p)); - - if (is.arr(fresh.config)) fresh.config = fresh.config[index]; - index++; //this.stop() - - if (local === _this3.guid) return last = new Promise(function (r) { - return _this3.diff(fresh).start(r); - }); - return; - }, // cancel() - function (finished) { - if (finished === void 0) { - finished = true; - } - - return _this3.stop(finished); - }).then(function () { - return last; - }); - }); - } - - queue.then(onEnd); - }; - - _proto.diff = function diff(props) { - var _this4 = this; - - this.props = _extends({}, this.props, props); - var _this$props = this.props, - _this$props$from = _this$props.from, - from = _this$props$from === void 0 ? {} : _this$props$from, - _this$props$to = _this$props.to, - to = _this$props$to === void 0 ? {} : _this$props$to, - _this$props$config = _this$props.config, - config = _this$props$config === void 0 ? {} : _this$props$config, - reverse = _this$props.reverse, - attach = _this$props.attach, - reset = _this$props.reset, - immediate = _this$props.immediate; // Reverse values when requested - - if (reverse) { - var _ref6 = [to, from]; - from = _ref6[0]; - to = _ref6[1]; - } // This will collect all props that were ever set, reset merged props when necessary - - - this.merged = _extends({}, from, this.merged, to); - this.hasChanged = false; // Attachment handling, trailed springs can "attach" themselves to a previous spring - - var target = attach && attach(this); // Reduces input { name: value } pairs into animated values - - this.animations = Object.entries(this.merged).reduce(function (acc, _ref7) { - var name = _ref7[0], - value = _ref7[1]; - // Issue cached entries, except on reset - var entry = acc[name] || {}; // Figure out what the value is supposed to be - - var isNumber = is.num(value); - var isString = is.str(value) && !value.startsWith('#') && !/\d/.test(value) && !colorNames[value]; - var isArray = is.arr(value); - var isInterpolation = !isNumber && !isArray && !isString; - var fromValue = !is.und(from[name]) ? from[name] : value; - var toValue = isNumber || isArray ? value : isString ? value : 1; - var toConfig = callProp(config, name); - if (target) toValue = target.animations[name].parent; - var parent = entry.parent, - interpolation$$1 = entry.interpolation, - toValues = toArray(target ? toValue.getPayload() : toValue), - animatedValues; - var newValue = value; - if (isInterpolation) newValue = interpolation({ - range: [0, 1], - output: [value, value] - })(1); - var currentValue = interpolation$$1 && interpolation$$1.getValue(); // Change detection flags - - var isFirst = is.und(parent); - var isActive = !isFirst && entry.animatedValues.some(function (v) { - return !v.done; - }); - var currentValueDiffersFromGoal = !is.equ(newValue, currentValue); - var hasNewGoal = !is.equ(newValue, entry.previous); - var hasNewConfig = !is.equ(toConfig, entry.config); // Change animation props when props indicate a new goal (new value differs from previous one) - // and current values differ from it. Config changes trigger a new update as well (though probably shouldn't?) - - if (reset || hasNewGoal && currentValueDiffersFromGoal || hasNewConfig) { - var _extends2; - - // Convert regular values into animated values, ALWAYS re-use if possible - if (isNumber || isString) parent = interpolation$$1 = entry.parent || new AnimatedValue(fromValue);else if (isArray) parent = interpolation$$1 = entry.parent || new AnimatedValueArray(fromValue);else if (isInterpolation) { - var prev = entry.interpolation && entry.interpolation.calc(entry.parent.value); - prev = prev !== void 0 && !reset ? prev : fromValue; - - if (entry.parent) { - parent = entry.parent; - parent.setValue(0, false); - } else parent = new AnimatedValue(0); - - var range = { - output: [prev, value] - }; - - if (entry.interpolation) { - interpolation$$1 = entry.interpolation; - entry.interpolation.updateConfig(range); - } else interpolation$$1 = parent.interpolate(range); - } - toValues = toArray(target ? toValue.getPayload() : toValue); - animatedValues = toArray(parent.getPayload()); - if (reset && !isInterpolation) parent.setValue(fromValue, false); - _this4.hasChanged = true; // Reset animated values - - animatedValues.forEach(function (value) { - value.startPosition = value.value; - value.lastPosition = value.value; - value.lastVelocity = isActive ? value.lastVelocity : undefined; - value.lastTime = isActive ? value.lastTime : undefined; - value.startTime = now(); - value.done = false; - value.animatedStyles.clear(); - }); // Set immediate values - - if (callProp(immediate, name)) { - parent.setValue(isInterpolation ? toValue : value, false); - } - - return _extends({}, acc, (_extends2 = {}, _extends2[name] = _extends({}, entry, { - name: name, - parent: parent, - interpolation: interpolation$$1, - animatedValues: animatedValues, - toValues: toValues, - previous: newValue, - config: toConfig, - fromValues: toArray(parent.getValue()), - immediate: callProp(immediate, name), - initialVelocity: withDefault(toConfig.velocity, 0), - clamp: withDefault(toConfig.clamp, false), - precision: withDefault(toConfig.precision, 0.01), - tension: withDefault(toConfig.tension, 170), - friction: withDefault(toConfig.friction, 26), - mass: withDefault(toConfig.mass, 1), - duration: toConfig.duration, - easing: withDefault(toConfig.easing, function (t) { - return t; - }), - decay: toConfig.decay - }), _extends2)); - } else { - if (!currentValueDiffersFromGoal) { - var _extends3; - - // So ... the current target value (newValue) appears to be different from the previous value, - // which normally constitutes an update, but the actual value (currentValue) matches the target! - // In order to resolve this without causing an animation update we silently flag the animation as done, - // which it technically is. Interpolations also needs a config update with their target set to 1. - if (isInterpolation) { - parent.setValue(1, false); - interpolation$$1.updateConfig({ - output: [newValue, newValue] - }); - } - - parent.done = true; - _this4.hasChanged = true; - return _extends({}, acc, (_extends3 = {}, _extends3[name] = _extends({}, acc[name], { - previous: newValue - }), _extends3)); - } - - return acc; - } - }, this.animations); - - if (this.hasChanged) { - // Make animations available to frameloop - this.configs = Object.values(this.animations); - this.values = {}; - this.interpolations = {}; - - for (var key in this.animations) { - this.interpolations[key] = this.animations[key].interpolation; - this.values[key] = this.animations[key].interpolation.getValue(); - } - } - - return this; - }; - - _proto.destroy = function destroy() { - this.stop(); - this.props = {}; - this.merged = {}; - this.animations = {}; - this.interpolations = {}; - this.values = {}; - this.configs = []; - this.local = 0; - }; - - return Controller; -}(); - -/** API - * const props = useSprings(number, [{ ... }, { ... }, ...]) - * const [props, set] = useSprings(number, (i, controller) => ({ ... })) - */ - -var useSprings = function useSprings(length, props) { - var mounted = React.useRef(false); - var ctrl = React.useRef(); - var isFn = is.fun(props); // The controller maintains the animation values, starts and stops animations - - var _useMemo = React.useMemo(function () { - // Remove old controllers - if (ctrl.current) { - ctrl.current.map(function (c) { - return c.destroy(); - }); - ctrl.current = undefined; - } - - var ref; - return [new Array(length).fill().map(function (_, i) { - var ctrl = new Controller(); - var newProps = isFn ? callProp(props, i, ctrl) : props[i]; - if (i === 0) ref = newProps.ref; - ctrl.update(newProps); - if (!ref) ctrl.start(); - return ctrl; - }), ref]; - }, [length]), - controllers = _useMemo[0], - ref = _useMemo[1]; - - ctrl.current = controllers; // The hooks reference api gets defined here ... - - var api = React.useImperativeHandle(ref, function () { - return { - start: function start() { - return Promise.all(ctrl.current.map(function (c) { - return new Promise(function (r) { - return c.start(r); - }); - })); - }, - stop: function stop(finished) { - return ctrl.current.forEach(function (c) { - return c.stop(finished); - }); - }, - - get controllers() { - return ctrl.current; - } - - }; - }); // This function updates the controllers - - var updateCtrl = React.useMemo(function () { - return function (updateProps) { - return ctrl.current.map(function (c, i) { - c.update(isFn ? callProp(updateProps, i, c) : updateProps[i]); - if (!ref) c.start(); - }); - }; - }, [length]); // Update controller if props aren't functional - - React.useEffect(function () { - if (mounted.current) { - if (!isFn) updateCtrl(props); - } else if (!ref) ctrl.current.forEach(function (c) { - return c.start(); - }); - }); // Update mounted flag and destroy controller on unmount - - React.useEffect(function () { - return mounted.current = true, function () { - return ctrl.current.forEach(function (c) { - return c.destroy(); - }); - }; - }, []); // Return animated props, or, anim-props + the update-setter above - - var propValues = ctrl.current.map(function (c) { - return c.getValues(); - }); - return isFn ? [propValues, updateCtrl, function (finished) { - return ctrl.current.forEach(function (c) { - return c.pause(finished); - }); - }] : propValues; -}; - -/** API - * const props = useSpring({ ... }) - * const [props, set] = useSpring(() => ({ ... })) - */ - -var useSpring = function useSpring(props) { - var isFn = is.fun(props); - - var _useSprings = useSprings(1, isFn ? props : [props]), - result = _useSprings[0], - set = _useSprings[1], - pause = _useSprings[2]; - - return isFn ? [result[0], set, pause] : result; -}; - -/** API - * const trails = useTrail(number, { ... }) - * const [trails, set] = useTrail(number, () => ({ ... })) - */ - -var useTrail = function useTrail(length, props) { - var mounted = React.useRef(false); - var isFn = is.fun(props); - var updateProps = callProp(props); - var instances = React.useRef(); - - var _useSprings = useSprings(length, function (i, ctrl) { - if (i === 0) instances.current = []; - instances.current.push(ctrl); - return _extends({}, updateProps, { - config: callProp(updateProps.config, i), - attach: i > 0 && function () { - return instances.current[i - 1]; - } - }); - }), - result = _useSprings[0], - set = _useSprings[1], - pause = _useSprings[2]; // Set up function to update controller - - - var updateCtrl = React.useMemo(function () { - return function (props) { - return set(function (i, ctrl) { - var last = props.reverse ? i === 0 : length - 1 === i; - var attachIdx = props.reverse ? i + 1 : i - 1; - var attachController = instances.current[attachIdx]; - return _extends({}, props, { - config: callProp(props.config || updateProps.config, i), - attach: attachController && function () { - return attachController; - } - }); - }); - }; - }, [length, updateProps.reverse]); // Update controller if props aren't functional - - React.useEffect(function () { - return void (mounted.current && !isFn && updateCtrl(props)); - }); // Update mounted flag and destroy controller on unmount - - React.useEffect(function () { - return void (mounted.current = true); - }, []); - return isFn ? [result, updateCtrl, pause] : result; -}; - -/** API - * const transitions = useTransition(items, itemKeys, { ... }) - * const [transitions, update] = useTransition(items, itemKeys, () => ({ ... })) - */ - -var guid = 0; -var ENTER = 'enter'; -var LEAVE = 'leave'; -var UPDATE = 'update'; - -var mapKeys = function mapKeys(items, keys) { - return (typeof keys === 'function' ? items.map(keys) : toArray(keys)).map(String); -}; - -var get = function get(props) { - var items = props.items, - _props$keys = props.keys, - keys = _props$keys === void 0 ? function (item) { - return item; - } : _props$keys, - rest = _objectWithoutPropertiesLoose(props, ["items", "keys"]); - - items = toArray(items !== void 0 ? items : null); - return _extends({ - items: items, - keys: mapKeys(items, keys) - }, rest); -}; - -function useTransition(input, keyTransform, config) { - var props = _extends({ - items: input, - keys: keyTransform || function (i) { - return i; - } - }, config); - - var _get = get(props), - _get$lazy = _get.lazy, - lazy = _get$lazy === void 0 ? false : _get$lazy, - _get$unique = _get.unique, - _get$reset = _get.reset, - reset = _get$reset === void 0 ? false : _get$reset, - enter = _get.enter, - leave = _get.leave, - update = _get.update, - onDestroyed = _get.onDestroyed, - keys = _get.keys, - items = _get.items, - onFrame = _get.onFrame, - _onRest = _get.onRest, - onStart = _get.onStart, - ref = _get.ref, - extra = _objectWithoutPropertiesLoose(_get, ["lazy", "unique", "reset", "enter", "leave", "update", "onDestroyed", "keys", "items", "onFrame", "onRest", "onStart", "ref"]); - - var forceUpdate = useForceUpdate(); - var mounted = React.useRef(false); - var state = React.useRef({ - mounted: false, - first: true, - deleted: [], - current: {}, - transitions: [], - prevProps: {}, - paused: !!props.ref, - instances: !mounted.current && new Map(), - forceUpdate: forceUpdate - }); - React.useImperativeHandle(props.ref, function () { - return { - start: function start() { - return Promise.all(Array.from(state.current.instances).map(function (_ref) { - var c = _ref[1]; - return new Promise(function (r) { - return c.start(r); - }); - })); - }, - stop: function stop(finished) { - return Array.from(state.current.instances).forEach(function (_ref2) { - var c = _ref2[1]; - return c.stop(finished); - }); - }, - - get controllers() { - return Array.from(state.current.instances).map(function (_ref3) { - var c = _ref3[1]; - return c; - }); - } - - }; - }); // Update state - - state.current = diffItems(state.current, props); - - if (state.current.changed) { - // Update state - state.current.transitions.forEach(function (transition) { - var slot = transition.slot, - from = transition.from, - to = transition.to, - config = transition.config, - trail = transition.trail, - key = transition.key, - item = transition.item; - if (!state.current.instances.has(key)) state.current.instances.set(key, new Controller()); // update the map object - - var ctrl = state.current.instances.get(key); - - var newProps = _extends({}, extra, { - to: to, - from: from, - config: config, - ref: ref, - onRest: function onRest(values) { - if (state.current.mounted) { - if (transition.destroyed) { - // If no ref is given delete destroyed items immediately - if (!ref && !lazy) cleanUp(state, key); - if (onDestroyed) onDestroyed(item); - } // A transition comes to rest once all its springs conclude - - - var curInstances = Array.from(state.current.instances); - var active = curInstances.some(function (_ref4) { - var c = _ref4[1]; - return !c.idle; - }); - if (!active && (ref || lazy) && state.current.deleted.length > 0) cleanUp(state); - if (_onRest) _onRest(item, slot, values); - } - }, - onStart: onStart && function () { - return onStart(item, slot); - }, - onFrame: onFrame && function (values) { - return onFrame(item, slot, values); - }, - delay: trail, - reset: reset && slot === ENTER // Update controller - - }); - - ctrl.update(newProps); - if (!state.current.paused) ctrl.start(); - }); - } - - React.useEffect(function () { - state.current.mounted = mounted.current = true; - return function () { - state.current.mounted = mounted.current = false; - Array.from(state.current.instances).map(function (_ref5) { - var c = _ref5[1]; - return c.destroy(); - }); - state.current.instances.clear(); - }; - }, []); - return state.current.transitions.map(function (_ref6) { - var item = _ref6.item, - slot = _ref6.slot, - key = _ref6.key; - return { - item: item, - key: key, - state: slot, - props: state.current.instances.get(key).getValues() - }; - }); -} - -function cleanUp(state, filterKey) { - var deleted = state.current.deleted; - - var _loop = function _loop() { - if (_isArray) { - if (_i >= _iterator.length) return "break"; - _ref8 = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) return "break"; - _ref8 = _i.value; - } - - var _ref7 = _ref8; - var key = _ref7.key; - - var filter = function filter(t) { - return t.key !== key; - }; - - if (is.und(filterKey) || filterKey === key) { - state.current.instances.delete(key); - state.current.transitions = state.current.transitions.filter(filter); - state.current.deleted = state.current.deleted.filter(filter); - } - }; - - for (var _iterator = deleted, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref8; - - var _ret = _loop(); - - if (_ret === "break") break; - } - - state.current.forceUpdate(); -} - -function diffItems(_ref9, props) { - var first = _ref9.first, - prevProps = _ref9.prevProps, - state = _objectWithoutPropertiesLoose(_ref9, ["first", "prevProps"]); - - var _get2 = get(props), - items = _get2.items, - keys = _get2.keys, - initial = _get2.initial, - from = _get2.from, - enter = _get2.enter, - leave = _get2.leave, - update = _get2.update, - _get2$trail = _get2.trail, - trail = _get2$trail === void 0 ? 0 : _get2$trail, - unique = _get2.unique, - config = _get2.config, - _get2$order = _get2.order, - order = _get2$order === void 0 ? [ENTER, LEAVE, UPDATE] : _get2$order; - - var _get3 = get(prevProps), - _keys = _get3.keys, - _items = _get3.items; - - var current = _extends({}, state.current); - - var deleted = [].concat(state.deleted); // Compare next keys with current keys - - var currentKeys = Object.keys(current); - var currentSet = new Set(currentKeys); - var nextSet = new Set(keys); - var added = keys.filter(function (item) { - return !currentSet.has(item); - }); - var removed = state.transitions.filter(function (item) { - return !item.destroyed && !nextSet.has(item.originalKey); - }).map(function (i) { - return i.originalKey; - }); - var updated = keys.filter(function (item) { - return currentSet.has(item); - }); - var delay = -trail; - - while (order.length) { - var changeType = order.shift(); - - switch (changeType) { - case ENTER: - { - added.forEach(function (key, index) { - // In unique mode, remove fading out transitions if their key comes in again - if (unique && deleted.find(function (d) { - return d.originalKey === key; - })) deleted = deleted.filter(function (t) { - return t.originalKey !== key; - }); - var keyIndex = keys.indexOf(key); - var item = items[keyIndex]; - var slot = first && initial !== void 0 ? 'initial' : ENTER; - current[key] = { - slot: slot, - originalKey: key, - key: unique ? String(key) : guid++, - item: item, - trail: delay = delay + trail, - config: callProp(config, item, slot), - from: callProp(first ? initial !== void 0 ? initial || {} : from : from, item), - to: callProp(enter, item) - }; - }); - break; - } - - case LEAVE: - { - removed.forEach(function (key) { - var keyIndex = _keys.indexOf(key); - - var item = _items[keyIndex]; - var slot = LEAVE; - deleted.unshift(_extends({}, current[key], { - slot: slot, - destroyed: true, - left: _keys[Math.max(0, keyIndex - 1)], - right: _keys[Math.min(_keys.length, keyIndex + 1)], - trail: delay = delay + trail, - config: callProp(config, item, slot), - to: callProp(leave, item) - })); - delete current[key]; - }); - break; - } - - case UPDATE: - { - updated.forEach(function (key) { - var keyIndex = keys.indexOf(key); - var item = items[keyIndex]; - var slot = UPDATE; - current[key] = _extends({}, current[key], { - item: item, - slot: slot, - trail: delay = delay + trail, - config: callProp(config, item, slot), - to: callProp(update, item) - }); - }); - break; - } - } - } - - var out = keys.map(function (key) { - return current[key]; - }); // This tries to restore order for deleted items by finding their last known siblings - // only using the left sibling to keep order placement consistent for all deleted items - - deleted.forEach(function (_ref10) { - var left = _ref10.left, - right = _ref10.right, - item = _objectWithoutPropertiesLoose(_ref10, ["left", "right"]); - - var pos; // Was it the element on the left, if yes, move there ... - - if ((pos = out.findIndex(function (t) { - return t.originalKey === left; - })) !== -1) pos += 1; // And if nothing else helps, move it to the start ¯\_(ツ)_/¯ - - pos = Math.max(0, pos); - out = [].concat(out.slice(0, pos), [item], out.slice(pos)); - }); - return _extends({}, state, { - changed: added.length || removed.length || updated.length, - first: first && added.length === 0, - transitions: out, - current: current, - deleted: deleted, - prevProps: props - }); -} - -var AnimatedStyle = -/*#__PURE__*/ -function (_AnimatedObject) { - _inheritsLoose(AnimatedStyle, _AnimatedObject); - - function AnimatedStyle(style) { - var _this; - - if (style === void 0) { - style = {}; - } - - _this = _AnimatedObject.call(this) || this; - - if (style.transform && !(style.transform instanceof Animated)) { - style = applyAnimatedValues.transform(style); - } - - _this.payload = style; - return _this; - } - - return AnimatedStyle; -}(AnimatedObject); - -// http://www.w3.org/TR/css3-color/#svg-color -var colors = { - transparent: 0x00000000, - aliceblue: 0xf0f8ffff, - antiquewhite: 0xfaebd7ff, - aqua: 0x00ffffff, - aquamarine: 0x7fffd4ff, - azure: 0xf0ffffff, - beige: 0xf5f5dcff, - bisque: 0xffe4c4ff, - black: 0x000000ff, - blanchedalmond: 0xffebcdff, - blue: 0x0000ffff, - blueviolet: 0x8a2be2ff, - brown: 0xa52a2aff, - burlywood: 0xdeb887ff, - burntsienna: 0xea7e5dff, - cadetblue: 0x5f9ea0ff, - chartreuse: 0x7fff00ff, - chocolate: 0xd2691eff, - coral: 0xff7f50ff, - cornflowerblue: 0x6495edff, - cornsilk: 0xfff8dcff, - crimson: 0xdc143cff, - cyan: 0x00ffffff, - darkblue: 0x00008bff, - darkcyan: 0x008b8bff, - darkgoldenrod: 0xb8860bff, - darkgray: 0xa9a9a9ff, - darkgreen: 0x006400ff, - darkgrey: 0xa9a9a9ff, - darkkhaki: 0xbdb76bff, - darkmagenta: 0x8b008bff, - darkolivegreen: 0x556b2fff, - darkorange: 0xff8c00ff, - darkorchid: 0x9932ccff, - darkred: 0x8b0000ff, - darksalmon: 0xe9967aff, - darkseagreen: 0x8fbc8fff, - darkslateblue: 0x483d8bff, - darkslategray: 0x2f4f4fff, - darkslategrey: 0x2f4f4fff, - darkturquoise: 0x00ced1ff, - darkviolet: 0x9400d3ff, - deeppink: 0xff1493ff, - deepskyblue: 0x00bfffff, - dimgray: 0x696969ff, - dimgrey: 0x696969ff, - dodgerblue: 0x1e90ffff, - firebrick: 0xb22222ff, - floralwhite: 0xfffaf0ff, - forestgreen: 0x228b22ff, - fuchsia: 0xff00ffff, - gainsboro: 0xdcdcdcff, - ghostwhite: 0xf8f8ffff, - gold: 0xffd700ff, - goldenrod: 0xdaa520ff, - gray: 0x808080ff, - green: 0x008000ff, - greenyellow: 0xadff2fff, - grey: 0x808080ff, - honeydew: 0xf0fff0ff, - hotpink: 0xff69b4ff, - indianred: 0xcd5c5cff, - indigo: 0x4b0082ff, - ivory: 0xfffff0ff, - khaki: 0xf0e68cff, - lavender: 0xe6e6faff, - lavenderblush: 0xfff0f5ff, - lawngreen: 0x7cfc00ff, - lemonchiffon: 0xfffacdff, - lightblue: 0xadd8e6ff, - lightcoral: 0xf08080ff, - lightcyan: 0xe0ffffff, - lightgoldenrodyellow: 0xfafad2ff, - lightgray: 0xd3d3d3ff, - lightgreen: 0x90ee90ff, - lightgrey: 0xd3d3d3ff, - lightpink: 0xffb6c1ff, - lightsalmon: 0xffa07aff, - lightseagreen: 0x20b2aaff, - lightskyblue: 0x87cefaff, - lightslategray: 0x778899ff, - lightslategrey: 0x778899ff, - lightsteelblue: 0xb0c4deff, - lightyellow: 0xffffe0ff, - lime: 0x00ff00ff, - limegreen: 0x32cd32ff, - linen: 0xfaf0e6ff, - magenta: 0xff00ffff, - maroon: 0x800000ff, - mediumaquamarine: 0x66cdaaff, - mediumblue: 0x0000cdff, - mediumorchid: 0xba55d3ff, - mediumpurple: 0x9370dbff, - mediumseagreen: 0x3cb371ff, - mediumslateblue: 0x7b68eeff, - mediumspringgreen: 0x00fa9aff, - mediumturquoise: 0x48d1ccff, - mediumvioletred: 0xc71585ff, - midnightblue: 0x191970ff, - mintcream: 0xf5fffaff, - mistyrose: 0xffe4e1ff, - moccasin: 0xffe4b5ff, - navajowhite: 0xffdeadff, - navy: 0x000080ff, - oldlace: 0xfdf5e6ff, - olive: 0x808000ff, - olivedrab: 0x6b8e23ff, - orange: 0xffa500ff, - orangered: 0xff4500ff, - orchid: 0xda70d6ff, - palegoldenrod: 0xeee8aaff, - palegreen: 0x98fb98ff, - paleturquoise: 0xafeeeeff, - palevioletred: 0xdb7093ff, - papayawhip: 0xffefd5ff, - peachpuff: 0xffdab9ff, - peru: 0xcd853fff, - pink: 0xffc0cbff, - plum: 0xdda0ddff, - powderblue: 0xb0e0e6ff, - purple: 0x800080ff, - rebeccapurple: 0x663399ff, - red: 0xff0000ff, - rosybrown: 0xbc8f8fff, - royalblue: 0x4169e1ff, - saddlebrown: 0x8b4513ff, - salmon: 0xfa8072ff, - sandybrown: 0xf4a460ff, - seagreen: 0x2e8b57ff, - seashell: 0xfff5eeff, - sienna: 0xa0522dff, - silver: 0xc0c0c0ff, - skyblue: 0x87ceebff, - slateblue: 0x6a5acdff, - slategray: 0x708090ff, - slategrey: 0x708090ff, - snow: 0xfffafaff, - springgreen: 0x00ff7fff, - steelblue: 0x4682b4ff, - tan: 0xd2b48cff, - teal: 0x008080ff, - thistle: 0xd8bfd8ff, - tomato: 0xff6347ff, - turquoise: 0x40e0d0ff, - violet: 0xee82eeff, - wheat: 0xf5deb3ff, - white: 0xffffffff, - whitesmoke: 0xf5f5f5ff, - yellow: 0xffff00ff, - yellowgreen: 0x9acd32ff -}; - -// const INTEGER = '[-+]?\\d+'; -var NUMBER = '[-+]?\\d*\\.?\\d+'; -var PERCENTAGE = NUMBER + '%'; - -function call() { - for (var _len = arguments.length, parts = new Array(_len), _key = 0; _key < _len; _key++) { - parts[_key] = arguments[_key]; - } - - return '\\(\\s*(' + parts.join(')\\s*,\\s*(') + ')\\s*\\)'; -} - -var rgb = new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER)); -var rgba = new RegExp('rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER)); -var hsl = new RegExp('hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE)); -var hsla = new RegExp('hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER)); -var hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/; -var hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/; -var hex6 = /^#([0-9a-fA-F]{6})$/; -var hex8 = /^#([0-9a-fA-F]{8})$/; - -/* -https://github.com/react-community/normalize-css-color - -BSD 3-Clause License - -Copyright (c) 2016, React Community -All rights reserved. - -Redistribution and use 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 the copyright holder 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 HOLDER 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. -*/ -function normalizeColor(color) { - var match; - - if (typeof color === 'number') { - return color >>> 0 === color && color >= 0 && color <= 0xffffffff ? color : null; - } // Ordered based on occurrences on Facebook codebase - - - if (match = hex6.exec(color)) return parseInt(match[1] + 'ff', 16) >>> 0; - if (colors.hasOwnProperty(color)) return colors[color]; - - if (match = rgb.exec(color)) { - return (parse255(match[1]) << 24 | // r - parse255(match[2]) << 16 | // g - parse255(match[3]) << 8 | // b - 0x000000ff) >>> // a - 0; - } - - if (match = rgba.exec(color)) { - return (parse255(match[1]) << 24 | // r - parse255(match[2]) << 16 | // g - parse255(match[3]) << 8 | // b - parse1(match[4])) >>> // a - 0; - } - - if (match = hex3.exec(color)) { - return parseInt(match[1] + match[1] + // r - match[2] + match[2] + // g - match[3] + match[3] + // b - 'ff', // a - 16) >>> 0; - } // https://drafts.csswg.org/css-color-4/#hex-notation - - - if (match = hex8.exec(color)) return parseInt(match[1], 16) >>> 0; - - if (match = hex4.exec(color)) { - return parseInt(match[1] + match[1] + // r - match[2] + match[2] + // g - match[3] + match[3] + // b - match[4] + match[4], // a - 16) >>> 0; - } - - if (match = hsl.exec(color)) { - return (hslToRgb(parse360(match[1]), // h - parsePercentage(match[2]), // s - parsePercentage(match[3]) // l - ) | 0x000000ff) >>> // a - 0; - } - - if (match = hsla.exec(color)) { - return (hslToRgb(parse360(match[1]), // h - parsePercentage(match[2]), // s - parsePercentage(match[3]) // l - ) | parse1(match[4])) >>> // a - 0; - } - - return null; -} - -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; -} - -function hslToRgb(h, s, l) { - var q = l < 0.5 ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; - var r = hue2rgb(p, q, h + 1 / 3); - var g = hue2rgb(p, q, h); - var b = hue2rgb(p, q, h - 1 / 3); - return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8; -} - -function parse255(str) { - var int = parseInt(str, 10); - if (int < 0) return 0; - if (int > 255) return 255; - return int; -} - -function parse360(str) { - var int = parseFloat(str); - return (int % 360 + 360) % 360 / 360; -} - -function parse1(str) { - var num = parseFloat(str); - if (num < 0) return 0; - if (num > 1) return 255; - return Math.round(num * 255); -} - -function parsePercentage(str) { - // parseFloat conveniently ignores the final % - var int = parseFloat(str); - if (int < 0) return 0; - if (int > 100) return 1; - return int / 100; -} - -function colorToRgba(input) { - var int32Color = normalizeColor(input); - if (int32Color === null) return input; - int32Color = int32Color || 0; - var r = (int32Color & 0xff000000) >>> 24; - var g = (int32Color & 0x00ff0000) >>> 16; - var b = (int32Color & 0x0000ff00) >>> 8; - var a = (int32Color & 0x000000ff) / 255; - return "rgba(" + r + ", " + g + ", " + b + ", " + a + ")"; -} // Problem: https://github.com/animatedjs/animated/pull/102 -// Solution: https://stackoverflow.com/questions/638565/parsing-scientific-notation-sensibly/658662 - - -var stringShapeRegex = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g; // Covers rgb, rgba, hsl, hsla -// Taken from https://gist.github.com/olmokramer/82ccce673f86db7cda5e - -var colorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi; // Covers color names (transparent, blue, etc.) - -var colorNamesRegex = new RegExp("(" + Object.keys(colors).join('|') + ")", 'g'); -/** - * Supports string shapes by extracting numbers so new values can be computed, - * and recombines those values into new strings of the same shape. Supports - * things like: - * - * rgba(123, 42, 99, 0.36) // colors - * -45deg // values with units - * 0 2px 2px 0px rgba(0, 0, 0, 0.12) // box shadows - */ - -var createStringInterpolator = function createStringInterpolator(config) { - // Replace colors with rgba - var outputRange = config.output.map(function (rangeValue) { - return rangeValue.replace(colorRegex, colorToRgba); - }).map(function (rangeValue) { - return rangeValue.replace(colorNamesRegex, colorToRgba); - }); - var outputRanges = outputRange[0].match(stringShapeRegex).map(function () { - return []; - }); - outputRange.forEach(function (value) { - value.match(stringShapeRegex).forEach(function (number, i) { - return outputRanges[i].push(+number); - }); - }); - var interpolations = outputRange[0].match(stringShapeRegex).map(function (_value, i) { - return createInterpolator(_extends({}, config, { - output: outputRanges[i] - })); - }); - return function (input) { - var i = 0; - return outputRange[0] // 'rgba(0, 100, 200, 0)' - // -> - // 'rgba(${interpolations[0](input)}, ${interpolations[1](input)}, ...' - .replace(stringShapeRegex, function () { - return interpolations[i++](input); - }) // rgba requires that the r,g,b are integers.... so we want to round them, but we *dont* want to - // round the opacity (4th column). - .replace(/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi, function (_, p1, p2, p3, p4) { - return "rgba(" + Math.round(p1) + ", " + Math.round(p2) + ", " + Math.round(p3) + ", " + p4 + ")"; - }); - }; -}; - -var isUnitlessNumber = { - animationIterationCount: true, - borderImageOutset: true, - borderImageSlice: true, - borderImageWidth: true, - boxFlex: true, - boxFlexGroup: true, - boxOrdinalGroup: true, - columnCount: true, - columns: true, - flex: true, - flexGrow: true, - flexPositive: true, - flexShrink: true, - flexNegative: true, - flexOrder: true, - gridRow: true, - gridRowEnd: true, - gridRowSpan: true, - gridRowStart: true, - gridColumn: true, - gridColumnEnd: true, - gridColumnSpan: true, - gridColumnStart: true, - fontWeight: true, - lineClamp: true, - lineHeight: true, - opacity: true, - order: true, - orphans: true, - tabSize: true, - widows: true, - zIndex: true, - zoom: true, - // SVG-related properties - fillOpacity: true, - floodOpacity: true, - stopOpacity: true, - strokeDasharray: true, - strokeDashoffset: true, - strokeMiterlimit: true, - strokeOpacity: true, - strokeWidth: true -}; - -var prefixKey = function prefixKey(prefix, key) { - return prefix + key.charAt(0).toUpperCase() + key.substring(1); -}; - -var prefixes = ['Webkit', 'Ms', 'Moz', 'O']; -isUnitlessNumber = Object.keys(isUnitlessNumber).reduce(function (acc, prop) { - prefixes.forEach(function (prefix) { - return acc[prefixKey(prefix, prop)] = acc[prop]; - }); - return acc; -}, isUnitlessNumber); - -function dangerousStyleValue(name, value, isCustomProperty) { - if (value == null || typeof value === 'boolean' || value === '') return ''; - if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers - - return ('' + value).trim(); -} - -var attributeCache = {}; -injectCreateAnimatedStyle(function (style) { - return new AnimatedStyle(style); -}); -injectDefaultElement('div'); -injectStringInterpolator(createStringInterpolator); -injectColorNames(colors); -injectApplyAnimatedValues(function (instance, props) { - if (instance.nodeType && instance.setAttribute !== undefined) { - var style = props.style, - children = props.children, - scrollTop = props.scrollTop, - scrollLeft = props.scrollLeft, - attributes = _objectWithoutPropertiesLoose(props, ["style", "children", "scrollTop", "scrollLeft"]); - - var filter = instance.nodeName === 'filter' || instance.parentNode && instance.parentNode.nodeName === 'filter'; - if (scrollTop !== void 0) instance.scrollTop = scrollTop; - if (scrollLeft !== void 0) instance.scrollLeft = scrollLeft; // Set textContent, if children is an animatable value - - if (children !== void 0) instance.textContent = children; // Set styles ... - - for (var styleName in style) { - if (!style.hasOwnProperty(styleName)) continue; - var isCustomProperty = styleName.indexOf('--') === 0; - var styleValue = dangerousStyleValue(styleName, style[styleName], isCustomProperty); - if (styleName === 'float') styleName = 'cssFloat'; - if (isCustomProperty) instance.style.setProperty(styleName, styleValue);else instance.style[styleName] = styleValue; - } // Set attributes ... - - - for (var name in attributes) { - // Attributes are written in dash case - var dashCase = filter ? name : attributeCache[name] || (attributeCache[name] = name.replace(/([A-Z])/g, function (n) { - return '-' + n.toLowerCase(); - })); - if (typeof instance.getAttribute(dashCase) !== 'undefined') instance.setAttribute(dashCase, attributes[name]); - } - - return; - } else return false; -}, function (style) { - return style; -}); - -var domElements = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', // SVG -'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan']; -// Extend animated with all the available THREE elements -var apply = merge(createAnimatedComponent, false); -var extendedAnimated = apply(domElements); - -exports.apply = apply; -exports.config = config; -exports.update = update; -exports.animated = extendedAnimated; -exports.a = extendedAnimated; -exports.interpolate = interpolate$1; -exports.Globals = Globals; -exports.useSpring = useSpring; -exports.useTrail = useTrail; -exports.useTransition = useTransition; -exports.useChain = useChain; -exports.useSprings = useSprings; - - -/***/ }), - -/***/ "Zss7": -/***/ (function(module, exports, __webpack_require__) { - -var __WEBPACK_AMD_DEFINE_RESULT__;// TinyColor v1.4.2 -// 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: -// - -// `rgbToRgb` -// Handle bounds / percentage checking to conform to CSS color spec -// -// *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 -// - -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 -// - -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 -// --------------------- -// 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 -// ------------------ -// -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 -// -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() { - - // - var CSS_INTEGER = "[-\\+]?\\d+%?"; - - // - 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); - - -/***/ }), - -/***/ "b2RC": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const grid = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7.8 16.5H5c-.3 0-.5-.2-.5-.5v-6.2h6.8v6.7zm0-8.3H4.5V5c0-.3.2-.5.5-.5h6.2v6.7zm8.3 7.8c0 .3-.2.5-.5.5h-6.2v-6.8h6.8V19zm0-7.8h-6.8V4.5H19c.3 0 .5.2.5.5v6.2z", - fillRule: "evenodd", - clipRule: "evenodd" -})); -/* harmony default export */ __webpack_exports__["a"] = (grid); - - -/***/ }), - -/***/ "bWcr": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const closeSmall = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" -})); -/* harmony default export */ __webpack_exports__["a"] = (closeSmall); - - -/***/ }), - -/***/ "btIw": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const keyboardReturn = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "-2 -2 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M6.734 16.106l2.176-2.38-1.093-1.028-3.846 4.158 3.846 4.157 1.093-1.027-2.176-2.38h2.811c1.125 0 2.25.03 3.374 0 1.428-.001 3.362-.25 4.963-1.277 1.66-1.065 2.868-2.906 2.868-5.859 0-2.479-1.327-4.896-3.65-5.93-1.82-.813-3.044-.8-4.806-.788l-.567.002v1.5c.184 0 .368 0 .553-.002 1.82-.007 2.704-.014 4.21.657 1.854.827 2.76 2.657 2.76 4.561 0 2.472-.973 3.824-2.178 4.596-1.258.807-2.864 1.04-4.163 1.04h-.02c-1.115.03-2.229 0-3.344 0H6.734z" -})); -/* harmony default export */ __webpack_exports__["a"] = (keyboardReturn); - - -/***/ }), - -/***/ "cDcd": -/***/ (function(module, exports) { - -(function() { module.exports = window["React"]; }()); - -/***/ }), - -/***/ "cGtP": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const search = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z" -})); -/* harmony default export */ __webpack_exports__["a"] = (search); - - -/***/ }), - -/***/ "cjQ8": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const arrowLeft = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M20 10.8H6.7l4.1-4.5-1.1-1.1-5.8 6.3 5.8 5.8 1.1-1.1-4-3.9H20z" -})); -/* harmony default export */ __webpack_exports__["a"] = (arrowLeft); - - -/***/ }), - -/***/ "eGrx": -/***/ (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; -}; - - -/***/ }), - -/***/ "fPbg": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const alignLeft = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M4 19.8h8.9v-1.5H4v1.5zm8.9-15.6H4v1.5h8.9V4.2zm-8.9 7v1.5h16v-1.5H4z" -})); -/* harmony default export */ __webpack_exports__["a"] = (alignLeft); - - -/***/ }), - -/***/ "g56x": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["hooks"]; }()); - -/***/ }), - -/***/ "gdqT": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["a11y"]; }()); - -/***/ }), - -/***/ "hF7m": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["keyboardShortcuts"]; }()); - -/***/ }), - -/***/ "iA5R": -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/*istanbul ignore start*/ - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.diffChars = diffChars; -exports.characterDiff = void 0; - -/*istanbul ignore end*/ -var -/*istanbul ignore start*/ -_base = _interopRequireDefault(__webpack_require__("smQA")) -/*istanbul ignore end*/ -; - -/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/*istanbul ignore end*/ -var characterDiff = new -/*istanbul ignore start*/ -_base -/*istanbul ignore end*/ -. -/*istanbul ignore start*/ -default -/*istanbul ignore end*/ -(); - -/*istanbul ignore start*/ -exports.characterDiff = characterDiff; - -/*istanbul ignore end*/ -function diffChars(oldStr, newStr, options) { - return characterDiff.diff(oldStr, newStr, options); -} - - -/***/ }), - -/***/ "iClF": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/** - * WordPress dependencies - */ - -/** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ - -/** - * Return an SVG icon. - * - * @param {IconProps} props icon is the SVG component to render - * size is a number specifiying the icon size in pixels - * Other props will be passed to wrapped SVG component - * - * @return {JSX.Element} Icon component - */ - -function Icon({ - icon, - size = 24, - ...props -}) { - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["cloneElement"])(icon, { - width: size, - height: size, - ...props - }); -} - -/* harmony default export */ __webpack_exports__["a"] = (Icon); - - -/***/ }), - -/***/ "jB5C": -/***/ (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); - -/***/ }), - -/***/ "jTPX": -/***/ (function(module, exports) { +/***/ 4827: +/***/ (function(module) { // This code has been refactored for 140 bytes // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js @@ -6299,411 +388,17 @@ /***/ }), -/***/ "l3Sj": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["i18n"]; }()); - -/***/ }), - -/***/ "onLe": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["notices"]; }()); - -/***/ }), - -/***/ "pPDe": -/***/ (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; -}); - - -/***/ }), - -/***/ "pVnL": -/***/ (function(module, exports) { - -function _extends() { - module.exports = _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; - }; - - module.exports["default"] = module.exports, module.exports.__esModule = true; - return _extends.apply(this, arguments); -} - -module.exports = _extends; -module.exports["default"] = module.exports, module.exports.__esModule = true; - -/***/ }), - -/***/ "plpT": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const alignCenter = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M16.4 4.2H7.6v1.5h8.9V4.2zM4 11.2v1.5h16v-1.5H4zm3.6 8.6h8.9v-1.5H7.6v1.5z" -})); -/* harmony default export */ __webpack_exports__["a"] = (alignCenter); - - -/***/ }), - -/***/ "qRz9": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["richText"]; }()); - -/***/ }), - -/***/ "rH4q": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const media = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M18.7 3H5.3C4 3 3 4 3 5.3v13.4C3 20 4 21 5.3 21h13.4c1.3 0 2.3-1 2.3-2.3V5.3C21 4 20 3 18.7 3zm.8 15.7c0 .4-.4.8-.8.8H5.3c-.4 0-.8-.4-.8-.8V5.3c0-.4.4-.8.8-.8h13.4c.4 0 .8.4.8.8v13.4zM10 15l5-3-5-3v6z" -})); -/* harmony default export */ __webpack_exports__["a"] = (media); - - -/***/ }), - -/***/ "rl8x": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["isShallowEqual"]; }()); - -/***/ }), - -/***/ "rmEH": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["htmlEntities"]; }()); - -/***/ }), - -/***/ "smQA": -/***/ (function(module, exports, __webpack_require__) { +/***/ 1198: +/***/ (function(__unused_webpack_module, exports) { "use strict"; /*istanbul ignore start*/ -Object.defineProperty(exports, "__esModule", { +Object.defineProperty(exports, "__esModule", ({ value: true -}); -exports.default = Diff; +})); +exports["default"] = Diff; /*istanbul ignore end*/ function Diff() {} @@ -7004,369 +699,2442 @@ /***/ }), -/***/ "tI+e": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["components"]; }()); +/***/ 1973: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +var __webpack_unused_export__; +/*istanbul ignore start*/ + + +__webpack_unused_export__ = ({ + value: true +}); +exports.Kx = diffChars; +__webpack_unused_export__ = void 0; + +/*istanbul ignore end*/ +var +/*istanbul ignore start*/ +_base = _interopRequireDefault(__webpack_require__(1198)) +/*istanbul ignore end*/ +; + +/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/*istanbul ignore end*/ +var characterDiff = new +/*istanbul ignore start*/ +_base +/*istanbul ignore end*/ +. +/*istanbul ignore start*/ +default +/*istanbul ignore end*/ +(); + +/*istanbul ignore start*/ +__webpack_unused_export__ = characterDiff; + +/*istanbul ignore end*/ +function diffChars(oldStr, newStr, options) { + return characterDiff.diff(oldStr, newStr, options); +} + + +/***/ }), + +/***/ 1345: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var util = __webpack_require__(5022); + +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; + +/***/ }), + +/***/ 5425: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +module.exports = __webpack_require__(1345); + +/***/ }), + +/***/ 5022: +/***/ (function(module) { + +"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); + +/***/ }), + +/***/ 8575: +/***/ (function(module) { + +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (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) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } +} + + +/***/ }), + +/***/ 9894: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +// Load in dependencies +var computedStyle = __webpack_require__(4827); + +/** + * 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; + + +/***/ }), + +/***/ 7970: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +module.exports = __webpack_require__(195); + + +/***/ }), + +/***/ 3110: +/***/ (function(module) { + +"use strict"; +/** + * Copyright (c) 2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule ExecutionEnvironment + */ + +/*jslint evil: true */ + + + +var canUseDOM = !!( + typeof window !== 'undefined' && + window.document && + window.document.createElement +); + +/** + * Simple, lightweight module assisting with the detection and context of + * Worker. Helps avoid circular dependencies and allows code to reason about + * whether or not they are in a Worker, even if they never include the main + * `ReactWorker` dependency. + */ +var ExecutionEnvironment = { + + canUseDOM: canUseDOM, + + canUseWorkers: typeof Worker !== 'undefined', + + canUseEventListeners: + canUseDOM && !!(window.addEventListener || window.attachEvent), + + canUseViewport: canUseDOM && !!window.screen, + + isInWorker: !canUseDOM // For now, this is true - might change in the future. + +}; + +module.exports = ExecutionEnvironment; + /***/ }), -/***/ "tr0p": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - +/***/ 3812: +/***/ (function(module) { + +/** + * Copyright 2004-present Facebook. All Rights Reserved. + * + * @providesModule UserAgent_DEPRECATED + */ + +/** + * Provides entirely client-side User Agent and OS detection. You should prefer + * the non-deprecated UserAgent module when possible, which exposes our + * authoritative server-side PHP-based detection to the client. + * + * Usage is straightforward: + * + * if (UserAgent_DEPRECATED.ie()) { + * // IE + * } + * + * You can also do version checks: + * + * if (UserAgent_DEPRECATED.ie() >= 7) { + * // IE7 or better + * } + * + * The browser functions will return NaN if the browser does not match, so + * you can also do version compares the other way: + * + * if (UserAgent_DEPRECATED.ie() < 7) { + * // IE6 or worse + * } + * + * Note that the version is a float and may include a minor version number, + * so you should always use range operators to perform comparisons, not + * strict equality. + * + * **Note:** You should **strongly** prefer capability detection to browser + * version detection where it's reasonable: + * + * http://www.quirksmode.org/js/support.html + * + * Further, we have a large number of mature wrapper functions and classes + * which abstract away many browser irregularities. Check the documentation, + * grep for things, or ask on javascript@lists.facebook.com before writing yet + * another copy of "event || window.event". + * + */ + +var _populated = false; + +// Browsers +var _ie, _firefox, _opera, _webkit, _chrome; + +// Actual IE browser for compatibility mode +var _ie_real_version; + +// Platforms +var _osx, _windows, _linux, _android; + +// Architectures +var _win64; + +// Devices +var _iphone, _ipad, _native; + +var _mobile; + +function _populate() { + if (_populated) { + return; + } + + _populated = true; + + // To work around buggy JS libraries that can't handle multi-digit + // version numbers, Opera 10's user agent string claims it's Opera + // 9, then later includes a Version/X.Y field: + // + // Opera/9.80 (foo) Presto/2.2.15 Version/10.10 + var uas = navigator.userAgent; + var agent = /(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(uas); + var os = /(Mac OS X)|(Windows)|(Linux)/.exec(uas); + + _iphone = /\b(iPhone|iP[ao]d)/.exec(uas); + _ipad = /\b(iP[ao]d)/.exec(uas); + _android = /Android/i.exec(uas); + _native = /FBAN\/\w+;/i.exec(uas); + _mobile = /Mobile/i.exec(uas); + + // Note that the IE team blog would have you believe you should be checking + // for 'Win64; x64'. But MSDN then reveals that you can actually be coming + // from either x64 or ia64; so ultimately, you should just check for Win64 + // as in indicator of whether you're in 64-bit IE. 32-bit IE on 64-bit + // Windows will send 'WOW64' instead. + _win64 = !!(/Win64/.exec(uas)); + + if (agent) { + _ie = agent[1] ? parseFloat(agent[1]) : ( + agent[5] ? parseFloat(agent[5]) : NaN); + // IE compatibility mode + if (_ie && document && document.documentMode) { + _ie = document.documentMode; + } + // grab the "true" ie version from the trident token if available + var trident = /(?:Trident\/(\d+.\d+))/.exec(uas); + _ie_real_version = trident ? parseFloat(trident[1]) + 4 : _ie; + + _firefox = agent[2] ? parseFloat(agent[2]) : NaN; + _opera = agent[3] ? parseFloat(agent[3]) : NaN; + _webkit = agent[4] ? parseFloat(agent[4]) : NaN; + if (_webkit) { + // We do not add the regexp to the above test, because it will always + // match 'safari' only since 'AppleWebKit' appears before 'Chrome' in + // the userAgent string. + agent = /(?:Chrome\/(\d+\.\d+))/.exec(uas); + _chrome = agent && agent[1] ? parseFloat(agent[1]) : NaN; + } else { + _chrome = NaN; + } + } else { + _ie = _firefox = _opera = _chrome = _webkit = NaN; + } + + if (os) { + if (os[1]) { + // Detect OS X version. If no version number matches, set _osx to true. + // Version examples: 10, 10_6_1, 10.7 + // Parses version number as a float, taking only first two sets of + // digits. If only one set of digits is found, returns just the major + // version number. + var ver = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(uas); + + _osx = ver ? parseFloat(ver[1].replace('_', '.')) : true; + } else { + _osx = false; + } + _windows = !!os[2]; + _linux = !!os[3]; + } else { + _osx = _windows = _linux = false; + } +} + +var UserAgent_DEPRECATED = { + + /** + * Check if the UA is Internet Explorer. + * + * + * @return float|NaN Version number (if match) or NaN. + */ + ie: function() { + return _populate() || _ie; + }, + + /** + * Check if we're in Internet Explorer compatibility mode. + * + * @return bool true if in compatibility mode, false if + * not compatibility mode or not ie + */ + ieCompatibilityMode: function() { + return _populate() || (_ie_real_version > _ie); + }, + + + /** + * Whether the browser is 64-bit IE. Really, this is kind of weak sauce; we + * only need this because Skype can't handle 64-bit IE yet. We need to remove + * this when we don't need it -- tracked by #601957. + */ + ie64: function() { + return UserAgent_DEPRECATED.ie() && _win64; + }, + + /** + * Check if the UA is Firefox. + * + * + * @return float|NaN Version number (if match) or NaN. + */ + firefox: function() { + return _populate() || _firefox; + }, + + + /** + * Check if the UA is Opera. + * + * + * @return float|NaN Version number (if match) or NaN. + */ + opera: function() { + return _populate() || _opera; + }, + + + /** + * Check if the UA is WebKit. + * + * + * @return float|NaN Version number (if match) or NaN. + */ + webkit: function() { + return _populate() || _webkit; + }, + + /** + * For Push + * WILL BE REMOVED VERY SOON. Use UserAgent_DEPRECATED.webkit + */ + safari: function() { + return UserAgent_DEPRECATED.webkit(); + }, + + /** + * Check if the UA is a Chrome browser. + * + * + * @return float|NaN Version number (if match) or NaN. + */ + chrome : function() { + return _populate() || _chrome; + }, + + + /** + * Check if the user is running Windows. + * + * @return bool `true' if the user's OS is Windows. + */ + windows: function() { + return _populate() || _windows; + }, + + + /** + * Check if the user is running Mac OS X. + * + * @return float|bool Returns a float if a version number is detected, + * otherwise true/false. + */ + osx: function() { + return _populate() || _osx; + }, + + /** + * Check if the user is running Linux. + * + * @return bool `true' if the user's OS is some flavor of Linux. + */ + linux: function() { + return _populate() || _linux; + }, + + /** + * Check if the user is running on an iPhone or iPod platform. + * + * @return bool `true' if the user is running some flavor of the + * iPhone OS. + */ + iphone: function() { + return _populate() || _iphone; + }, + + mobile: function() { + return _populate() || (_iphone || _ipad || _android || _mobile); + }, + + nativeApp: function() { + // webviews inside of the native apps + return _populate() || _native; + }, + + android: function() { + return _populate() || _android; + }, + + ipad: function() { + return _populate() || _ipad; + } +}; + +module.exports = UserAgent_DEPRECATED; + + +/***/ }), + +/***/ 7939: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/** + * Copyright 2013-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule isEventSupported + */ + + + +var ExecutionEnvironment = __webpack_require__(3110); + +var useHasFeature; +if (ExecutionEnvironment.canUseDOM) { + useHasFeature = + document.implementation && + document.implementation.hasFeature && + // always returns true in newer browsers as per the standard. + // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature + document.implementation.hasFeature('', '') !== true; +} + +/** + * Checks if an event is supported in the current execution environment. + * + * NOTE: This will not work correctly for non-generic events such as `change`, + * `reset`, `load`, `error`, and `select`. + * + * Borrows from Modernizr. + * + * @param {string} eventNameSuffix Event name, e.g. "click". + * @param {?boolean} capture Check if the capture phase is supported. + * @return {boolean} True if the event is supported. + * @internal + * @license Modernizr 3.0.0pre (Custom Build) | MIT + */ +function isEventSupported(eventNameSuffix, capture) { + if (!ExecutionEnvironment.canUseDOM || + capture && !('addEventListener' in document)) { + return false; + } + + var eventName = 'on' + eventNameSuffix; + var isSupported = eventName in document; + + if (!isSupported) { + var element = document.createElement('div'); + element.setAttribute(eventName, 'return;'); + isSupported = typeof element[eventName] === 'function'; + } + + if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') { + // This is the only way to test support for the `wheel` event in IE9+. + isSupported = document.implementation.hasFeature('Events.wheel', '3.0'); + } + + return isSupported; +} + +module.exports = isEventSupported; + + +/***/ }), + +/***/ 195: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule normalizeWheel + * @typechecks + */ + + + +var UserAgent_DEPRECATED = __webpack_require__(3812); + +var isEventSupported = __webpack_require__(7939); + + +// Reasonable defaults +var PIXEL_STEP = 10; +var LINE_HEIGHT = 40; +var PAGE_HEIGHT = 800; + +/** + * Mouse wheel (and 2-finger trackpad) support on the web sucks. It is + * complicated, thus this doc is long and (hopefully) detailed enough to answer + * your questions. + * + * If you need to react to the mouse wheel in a predictable way, this code is + * like your bestest friend. * hugs * + * + * As of today, there are 4 DOM event types you can listen to: + * + * 'wheel' -- Chrome(31+), FF(17+), IE(9+) + * 'mousewheel' -- Chrome, IE(6+), Opera, Safari + * 'MozMousePixelScroll' -- FF(3.5 only!) (2010-2013) -- don't bother! + * 'DOMMouseScroll' -- FF(0.9.7+) since 2003 + * + * So what to do? The is the best: + * + * normalizeWheel.getEventType(); + * + * In your event callback, use this code to get sane interpretation of the + * deltas. This code will return an object with properties: + * + * spinX -- normalized spin speed (use for zoom) - x plane + * spinY -- " - y plane + * pixelX -- normalized distance (to pixels) - x plane + * pixelY -- " - y plane + * + * Wheel values are provided by the browser assuming you are using the wheel to + * scroll a web page by a number of lines or pixels (or pages). Values can vary + * significantly on different platforms and browsers, forgetting that you can + * scroll at different speeds. Some devices (like trackpads) emit more events + * at smaller increments with fine granularity, and some emit massive jumps with + * linear speed or acceleration. + * + * This code does its best to normalize the deltas for you: + * + * - spin is trying to normalize how far the wheel was spun (or trackpad + * dragged). This is super useful for zoom support where you want to + * throw away the chunky scroll steps on the PC and make those equal to + * the slow and smooth tiny steps on the Mac. Key data: This code tries to + * resolve a single slow step on a wheel to 1. + * + * - pixel is normalizing the desired scroll delta in pixel units. You'll + * get the crazy differences between browsers, but at least it'll be in + * pixels! + * + * - positive value indicates scrolling DOWN/RIGHT, negative UP/LEFT. This + * should translate to positive value zooming IN, negative zooming OUT. + * This matches the newer 'wheel' event. + * + * Why are there spinX, spinY (or pixels)? + * + * - spinX is a 2-finger side drag on the trackpad, and a shift + wheel turn + * with a mouse. It results in side-scrolling in the browser by default. + * + * - spinY is what you expect -- it's the classic axis of a mouse wheel. + * + * - I dropped spinZ/pixelZ. It is supported by the DOM 3 'wheel' event and + * probably is by browsers in conjunction with fancy 3D controllers .. but + * you know. + * + * Implementation info: + * + * Examples of 'wheel' event if you scroll slowly (down) by one step with an + * average mouse: + * + * OS X + Chrome (mouse) - 4 pixel delta (wheelDelta -120) + * OS X + Safari (mouse) - N/A pixel delta (wheelDelta -12) + * OS X + Firefox (mouse) - 0.1 line delta (wheelDelta N/A) + * Win8 + Chrome (mouse) - 100 pixel delta (wheelDelta -120) + * Win8 + Firefox (mouse) - 3 line delta (wheelDelta -120) + * + * On the trackpad: + * + * OS X + Chrome (trackpad) - 2 pixel delta (wheelDelta -6) + * OS X + Firefox (trackpad) - 1 pixel delta (wheelDelta N/A) + * + * On other/older browsers.. it's more complicated as there can be multiple and + * also missing delta values. + * + * The 'wheel' event is more standard: + * + * http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents + * + * The basics is that it includes a unit, deltaMode (pixels, lines, pages), and + * deltaX, deltaY and deltaZ. Some browsers provide other values to maintain + * backward compatibility with older events. Those other values help us + * better normalize spin speed. Example of what the browsers provide: + * + * | event.wheelDelta | event.detail + * ------------------+------------------+-------------- + * Safari v5/OS X | -120 | 0 + * Safari v5/Win7 | -120 | 0 + * Chrome v17/OS X | -120 | 0 + * Chrome v17/Win7 | -120 | 0 + * IE9/Win7 | -120 | undefined + * Firefox v4/OS X | undefined | 1 + * Firefox v4/Win7 | undefined | 3 + * + */ +function normalizeWheel(/*object*/ event) /*object*/ { + var sX = 0, sY = 0, // spinX, spinY + pX = 0, pY = 0; // pixelX, pixelY + + // Legacy + if ('detail' in event) { sY = event.detail; } + if ('wheelDelta' in event) { sY = -event.wheelDelta / 120; } + if ('wheelDeltaY' in event) { sY = -event.wheelDeltaY / 120; } + if ('wheelDeltaX' in event) { sX = -event.wheelDeltaX / 120; } + + // side scrolling on FF with DOMMouseScroll + if ( 'axis' in event && event.axis === event.HORIZONTAL_AXIS ) { + sX = sY; + sY = 0; + } + + pX = sX * PIXEL_STEP; + pY = sY * PIXEL_STEP; + + if ('deltaY' in event) { pY = event.deltaY; } + if ('deltaX' in event) { pX = event.deltaX; } + + if ((pX || pY) && event.deltaMode) { + if (event.deltaMode == 1) { // delta in LINE units + pX *= LINE_HEIGHT; + pY *= LINE_HEIGHT; + } else { // delta in PAGE units + pX *= PAGE_HEIGHT; + pY *= PAGE_HEIGHT; + } + } + + // Fall-back if spin cannot be determined + if (pX && !sX) { sX = (pX < 1) ? -1 : 1; } + if (pY && !sY) { sY = (pY < 1) ? -1 : 1; } + + return { spinX : sX, + spinY : sY, + pixelX : pX, + pixelY : pY }; +} + + +/** + * The best combination if you prefer spinX + spinY normalization. It favors + * the older DOMMouseScroll for Firefox, as FF does not include wheelDelta with + * 'wheel' event, making spin speed determination impossible. + */ +normalizeWheel.getEventType = function() /*string*/ { + return (UserAgent_DEPRECATED.firefox()) + ? 'DOMMouseScroll' + : (isEventSupported('wheel')) + ? 'wheel' + : 'mousewheel'; +}; + +module.exports = normalizeWheel; + + +/***/ }), + +/***/ 5372: +/***/ (function(module, __unused_webpack_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__(9567); + +function emptyFunction() {} +function emptyFunctionWithReset() {} +emptyFunctionWithReset.resetWarningCache = emptyFunction; + +module.exports = function() { + function shim(props, propName, componentName, location, propFullName, secret) { + if (secret === ReactPropTypesSecret) { + // It is still safe when called from React. + return; + } + var err = new Error( + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use PropTypes.checkPropTypes() to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + err.name = 'Invariant Violation'; + throw err; + }; + shim.isRequired = shim; + function getShim() { + return shim; + }; + // Important! + // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. + var ReactPropTypes = { + array: shim, + bigint: shim, + bool: shim, + func: shim, + number: shim, + object: shim, + string: shim, + symbol: shim, + + any: shim, + arrayOf: getShim, + element: shim, + elementType: shim, + instanceOf: getShim, + node: shim, + objectOf: getShim, + oneOf: getShim, + oneOfType: getShim, + shape: getShim, + exact: getShim, + + checkPropTypes: emptyFunctionWithReset, + resetWarningCache: emptyFunction + }; + + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; + + +/***/ }), + +/***/ 2652: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +if (false) { var throwOnDirectAccess, ReactIs; } else { + // By explicitly using `prop-types` you are opting into new production behavior. + // http://fb.me/prop-types-in-prod + module.exports = __webpack_require__(5372)(); +} + + +/***/ }), + +/***/ 9567: +/***/ (function(module) { + +"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; + + +/***/ }), + +/***/ 5438: +/***/ (function(__unused_webpack_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__(9196); +var PropTypes = __webpack_require__(2652); +var autosize = __webpack_require__(6411); +var _getLineHeight = __webpack_require__(9894); +var getLineHeight = _getLineHeight; +var RESIZED = "autosize:resized"; +/** + * A light replacement for built-in textarea component + * which automaticaly adjusts its height to match the content + */ +var TextareaAutosizeClass = /** @class */ (function (_super) { + __extends(TextareaAutosizeClass, _super); + function TextareaAutosizeClass() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.state = { + lineHeight: null + }; + _this.textarea = null; + _this.onResize = function (e) { + if (_this.props.onResize) { + _this.props.onResize(e); + } + }; + _this.updateLineHeight = function () { + if (_this.textarea) { + _this.setState({ + lineHeight: getLineHeight(_this.textarea) + }); + } + }; + _this.onChange = function (e) { + var onChange = _this.props.onChange; + _this.currentValue = e.currentTarget.value; + onChange && onChange(e); + }; + return _this; + } + TextareaAutosizeClass.prototype.componentDidMount = function () { + var _this = this; + var _a = this.props, maxRows = _a.maxRows, async = _a.async; + if (typeof maxRows === "number") { + this.updateLineHeight(); + } + if (typeof maxRows === "number" || async) { + /* + the defer is needed to: + - force "autosize" to activate the scrollbar when this.props.maxRows is passed + - support StyledComponents (see #71) + */ + setTimeout(function () { return _this.textarea && autosize(_this.textarea); }); + } + else { + this.textarea && autosize(this.textarea); + } + if (this.textarea) { + this.textarea.addEventListener(RESIZED, this.onResize); + } + }; + TextareaAutosizeClass.prototype.componentWillUnmount = function () { + if (this.textarea) { + this.textarea.removeEventListener(RESIZED, this.onResize); + autosize.destroy(this.textarea); + } + }; + TextareaAutosizeClass.prototype.render = function () { + var _this = this; + var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight; + var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null; + return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) { + _this.textarea = element; + if (typeof _this.props.innerRef === 'function') { + _this.props.innerRef(element); + } + else if (_this.props.innerRef) { + _this.props.innerRef.current = element; + } + } }), children)); + }; + TextareaAutosizeClass.prototype.componentDidUpdate = function () { + this.textarea && autosize.update(this.textarea); + }; + TextareaAutosizeClass.defaultProps = { + rows: 1, + async: false + }; + TextareaAutosizeClass.propTypes = { + rows: PropTypes.number, + maxRows: PropTypes.number, + onResize: PropTypes.func, + innerRef: PropTypes.any, + async: PropTypes.bool + }; + return TextareaAutosizeClass; +}(React.Component)); +exports.TextareaAutosize = React.forwardRef(function (props, ref) { + return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref })); +}); + + +/***/ }), + +/***/ 773: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +var __webpack_unused_export__; + +__webpack_unused_export__ = true; +var TextareaAutosize_1 = __webpack_require__(5438); +exports.Z = TextareaAutosize_1.TextareaAutosize; + + +/***/ }), + +/***/ 3124: +/***/ (function(module) { + +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; +}; + + +/***/ }), + +/***/ 9196: +/***/ (function(module) { + +"use strict"; +module.exports = window["React"]; + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ !function() { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function() { return module['default']; } : +/******/ function() { return module; }; +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ !function() { +/******/ // 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 }); +/******/ }; +/******/ }(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be in strict mode. +!function() { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS -__webpack_require__.d(__webpack_exports__, "__experimentalGetBorderClassesAndStyles", function() { return /* reexport */ getBorderClassesAndStyles; }); -__webpack_require__.d(__webpack_exports__, "__experimentalUseBorderProps", function() { return /* reexport */ useBorderProps; }); -__webpack_require__.d(__webpack_exports__, "__experimentalGetColorClassesAndStyles", function() { return /* reexport */ getColorClassesAndStyles; }); -__webpack_require__.d(__webpack_exports__, "__experimentalUseColorProps", function() { return /* reexport */ useColorProps; }); -__webpack_require__.d(__webpack_exports__, "__experimentalUseCustomSides", function() { return /* reexport */ useCustomSides; }); -__webpack_require__.d(__webpack_exports__, "getColorClassName", function() { return /* reexport */ getColorClassName; }); -__webpack_require__.d(__webpack_exports__, "getColorObjectByAttributeValues", function() { return /* reexport */ getColorObjectByAttributeValues; }); -__webpack_require__.d(__webpack_exports__, "getColorObjectByColorValue", function() { return /* reexport */ getColorObjectByColorValue; }); -__webpack_require__.d(__webpack_exports__, "createCustomColorsHOC", function() { return /* reexport */ createCustomColorsHOC; }); -__webpack_require__.d(__webpack_exports__, "withColors", function() { return /* reexport */ withColors; }); -__webpack_require__.d(__webpack_exports__, "__experimentalUseColors", function() { return /* reexport */ __experimentalUseColors; }); -__webpack_require__.d(__webpack_exports__, "__experimentalGetGradientClass", function() { return /* reexport */ __experimentalGetGradientClass; }); -__webpack_require__.d(__webpack_exports__, "getGradientValueBySlug", function() { return /* reexport */ getGradientValueBySlug; }); -__webpack_require__.d(__webpack_exports__, "__experimentalGetGradientObjectByGradientValue", function() { return /* reexport */ __experimentalGetGradientObjectByGradientValue; }); -__webpack_require__.d(__webpack_exports__, "getGradientSlugByValue", function() { return /* reexport */ getGradientSlugByValue; }); -__webpack_require__.d(__webpack_exports__, "__experimentalUseGradient", function() { return /* reexport */ __experimentalUseGradient; }); -__webpack_require__.d(__webpack_exports__, "getFontSize", function() { return /* reexport */ getFontSize; }); -__webpack_require__.d(__webpack_exports__, "getFontSizeClass", function() { return /* reexport */ getFontSizeClass; }); -__webpack_require__.d(__webpack_exports__, "getFontSizeObjectByValue", function() { return /* reexport */ getFontSizeObjectByValue; }); -__webpack_require__.d(__webpack_exports__, "FontSizePicker", function() { return /* reexport */ font_size_picker; }); -__webpack_require__.d(__webpack_exports__, "withFontSizes", function() { return /* reexport */ with_font_sizes; }); -__webpack_require__.d(__webpack_exports__, "AlignmentControl", function() { return /* reexport */ AlignmentControl; }); -__webpack_require__.d(__webpack_exports__, "AlignmentToolbar", function() { return /* reexport */ AlignmentToolbar; }); -__webpack_require__.d(__webpack_exports__, "Autocomplete", function() { return /* reexport */ autocomplete; }); -__webpack_require__.d(__webpack_exports__, "BlockAlignmentControl", function() { return /* reexport */ BlockAlignmentControl; }); -__webpack_require__.d(__webpack_exports__, "BlockAlignmentToolbar", function() { return /* reexport */ BlockAlignmentToolbar; }); -__webpack_require__.d(__webpack_exports__, "__experimentalBlockFullHeightAligmentControl", function() { return /* reexport */ block_full_height_alignment_control; }); -__webpack_require__.d(__webpack_exports__, "__experimentalBlockAlignmentMatrixControl", function() { return /* reexport */ block_alignment_matrix_control; }); -__webpack_require__.d(__webpack_exports__, "BlockBreadcrumb", function() { return /* reexport */ block_breadcrumb; }); -__webpack_require__.d(__webpack_exports__, "BlockContextProvider", function() { return /* reexport */ BlockContextProvider; }); -__webpack_require__.d(__webpack_exports__, "BlockControls", function() { return /* reexport */ block_controls; }); -__webpack_require__.d(__webpack_exports__, "BlockFormatControls", function() { return /* reexport */ BlockFormatControls; }); -__webpack_require__.d(__webpack_exports__, "BlockColorsStyleSelector", function() { return /* reexport */ color_style_selector; }); -__webpack_require__.d(__webpack_exports__, "BlockEdit", function() { return /* reexport */ block_edit_BlockEdit; }); -__webpack_require__.d(__webpack_exports__, "useBlockEditContext", function() { return /* reexport */ useBlockEditContext; }); -__webpack_require__.d(__webpack_exports__, "BlockIcon", function() { return /* reexport */ BlockIcon; }); -__webpack_require__.d(__webpack_exports__, "BlockNavigationDropdown", function() { return /* reexport */ dropdown; }); -__webpack_require__.d(__webpack_exports__, "__experimentalBlockNavigationBlockFill", function() { return /* reexport */ BlockNavigationBlockFill; }); -__webpack_require__.d(__webpack_exports__, "__experimentalBlockNavigationEditor", function() { return /* reexport */ BlockNavigationEditor; }); -__webpack_require__.d(__webpack_exports__, "__experimentalBlockNavigationTree", function() { return /* reexport */ BlockNavigationTree; }); -__webpack_require__.d(__webpack_exports__, "__experimentalBlockVariationPicker", function() { return /* reexport */ block_variation_picker; }); -__webpack_require__.d(__webpack_exports__, "__experimentalBlockPatternSetup", function() { return /* reexport */ block_pattern_setup; }); -__webpack_require__.d(__webpack_exports__, "__experimentalBlockVariationTransforms", function() { return /* reexport */ block_variation_transforms; }); -__webpack_require__.d(__webpack_exports__, "BlockVerticalAlignmentToolbar", function() { return /* reexport */ BlockVerticalAlignmentToolbar; }); -__webpack_require__.d(__webpack_exports__, "BlockVerticalAlignmentControl", function() { return /* reexport */ BlockVerticalAlignmentControl; }); -__webpack_require__.d(__webpack_exports__, "__experimentalBorderStyleControl", function() { return /* reexport */ BorderStyleControl; }); -__webpack_require__.d(__webpack_exports__, "ButtonBlockerAppender", function() { return /* reexport */ ButtonBlockerAppender; }); -__webpack_require__.d(__webpack_exports__, "ButtonBlockAppender", function() { return /* reexport */ button_block_appender; }); -__webpack_require__.d(__webpack_exports__, "ColorPalette", function() { return /* reexport */ color_palette; }); -__webpack_require__.d(__webpack_exports__, "ColorPaletteControl", function() { return /* reexport */ ColorPaletteControl; }); -__webpack_require__.d(__webpack_exports__, "ContrastChecker", function() { return /* reexport */ contrast_checker; }); -__webpack_require__.d(__webpack_exports__, "__experimentalDuotoneControl", function() { return /* reexport */ duotone_control; }); -__webpack_require__.d(__webpack_exports__, "__experimentalGradientPicker", function() { return /* reexport */ gradient_picker; }); -__webpack_require__.d(__webpack_exports__, "__experimentalGradientPickerControl", function() { return /* reexport */ GradientPickerControl; }); -__webpack_require__.d(__webpack_exports__, "__experimentalGradientPickerPanel", function() { return /* reexport */ GradientPanel; }); -__webpack_require__.d(__webpack_exports__, "__experimentalFontAppearanceControl", function() { return /* reexport */ FontAppearanceControl; }); -__webpack_require__.d(__webpack_exports__, "__experimentalFontFamilyControl", function() { return /* reexport */ FontFamilyControl; }); -__webpack_require__.d(__webpack_exports__, "__experimentalColorGradientControl", function() { return /* reexport */ control; }); -__webpack_require__.d(__webpack_exports__, "__experimentalPanelColorGradientSettings", function() { return /* reexport */ panel_color_gradient_settings; }); -__webpack_require__.d(__webpack_exports__, "__experimentalImageSizeControl", function() { return /* reexport */ ImageSizeControl; }); -__webpack_require__.d(__webpack_exports__, "InnerBlocks", function() { return /* reexport */ inner_blocks; }); -__webpack_require__.d(__webpack_exports__, "__experimentalUseInnerBlocksProps", function() { return /* reexport */ useInnerBlocksProps; }); -__webpack_require__.d(__webpack_exports__, "InspectorAdvancedControls", function() { return /* reexport */ inspector_advanced_controls; }); -__webpack_require__.d(__webpack_exports__, "InspectorControls", function() { return /* reexport */ inspector_controls; }); -__webpack_require__.d(__webpack_exports__, "JustifyToolbar", function() { return /* reexport */ JustifyToolbar; }); -__webpack_require__.d(__webpack_exports__, "JustifyContentControl", function() { return /* reexport */ JustifyContentControl; }); -__webpack_require__.d(__webpack_exports__, "__experimentalLinkControl", function() { return /* reexport */ link_control; }); -__webpack_require__.d(__webpack_exports__, "__experimentalLinkControlSearchInput", function() { return /* reexport */ search_input; }); -__webpack_require__.d(__webpack_exports__, "__experimentalLinkControlSearchResults", function() { return /* reexport */ LinkControlSearchResults; }); -__webpack_require__.d(__webpack_exports__, "__experimentalLinkControlSearchItem", function() { return /* reexport */ search_item; }); -__webpack_require__.d(__webpack_exports__, "LineHeightControl", function() { return /* reexport */ LineHeightControl; }); -__webpack_require__.d(__webpack_exports__, "MediaReplaceFlow", function() { return /* reexport */ media_replace_flow; }); -__webpack_require__.d(__webpack_exports__, "MediaPlaceholder", function() { return /* reexport */ media_placeholder; }); -__webpack_require__.d(__webpack_exports__, "MediaUpload", function() { return /* reexport */ media_upload; }); -__webpack_require__.d(__webpack_exports__, "MediaUploadCheck", function() { return /* reexport */ check; }); -__webpack_require__.d(__webpack_exports__, "PanelColorSettings", function() { return /* reexport */ panel_color_settings; }); -__webpack_require__.d(__webpack_exports__, "PlainText", function() { return /* reexport */ plain_text; }); -__webpack_require__.d(__webpack_exports__, "__experimentalResponsiveBlockControl", function() { return /* reexport */ responsive_block_control; }); -__webpack_require__.d(__webpack_exports__, "RichText", function() { return /* reexport */ rich_text; }); -__webpack_require__.d(__webpack_exports__, "RichTextShortcut", function() { return /* reexport */ RichTextShortcut; }); -__webpack_require__.d(__webpack_exports__, "RichTextToolbarButton", function() { return /* reexport */ RichTextToolbarButton; }); -__webpack_require__.d(__webpack_exports__, "__unstableRichTextInputEvent", function() { return /* reexport */ input_event_unstableRichTextInputEvent; }); -__webpack_require__.d(__webpack_exports__, "ToolSelector", function() { return /* reexport */ tool_selector; }); -__webpack_require__.d(__webpack_exports__, "__experimentalUnitControl", function() { return /* reexport */ UnitControl; }); -__webpack_require__.d(__webpack_exports__, "URLInput", function() { return /* reexport */ url_input; }); -__webpack_require__.d(__webpack_exports__, "URLInputButton", function() { return /* reexport */ url_input_button; }); -__webpack_require__.d(__webpack_exports__, "URLPopover", function() { return /* reexport */ url_popover; }); -__webpack_require__.d(__webpack_exports__, "__experimentalImageURLInputUI", function() { return /* reexport */ ImageURLInputUI; }); -__webpack_require__.d(__webpack_exports__, "withColorContext", function() { return /* reexport */ with_color_context; }); -__webpack_require__.d(__webpack_exports__, "__unstableBlockSettingsMenuFirstItem", function() { return /* reexport */ block_settings_menu_first_item; }); -__webpack_require__.d(__webpack_exports__, "__unstableInserterMenuExtension", function() { return /* reexport */ inserter_menu_extension; }); -__webpack_require__.d(__webpack_exports__, "__experimentalPreviewOptions", function() { return /* reexport */ PreviewOptions; }); -__webpack_require__.d(__webpack_exports__, "__experimentalUseResizeCanvas", function() { return /* reexport */ useResizeCanvas; }); -__webpack_require__.d(__webpack_exports__, "BlockInspector", function() { return /* reexport */ block_inspector; }); -__webpack_require__.d(__webpack_exports__, "BlockList", function() { return /* reexport */ BlockList; }); -__webpack_require__.d(__webpack_exports__, "useBlockProps", function() { return /* reexport */ useBlockProps; }); -__webpack_require__.d(__webpack_exports__, "__experimentalLayoutStyle", function() { return /* reexport */ LayoutStyle; }); -__webpack_require__.d(__webpack_exports__, "BlockMover", function() { return /* reexport */ block_mover; }); -__webpack_require__.d(__webpack_exports__, "BlockPreview", function() { return /* reexport */ block_preview; }); -__webpack_require__.d(__webpack_exports__, "BlockSelectionClearer", function() { return /* reexport */ BlockSelectionClearer; }); -__webpack_require__.d(__webpack_exports__, "__unstableUseBlockSelectionClearer", function() { return /* reexport */ useBlockSelectionClearer; }); -__webpack_require__.d(__webpack_exports__, "BlockSettingsMenu", function() { return /* reexport */ block_settings_menu; }); -__webpack_require__.d(__webpack_exports__, "BlockSettingsMenuControls", function() { return /* reexport */ block_settings_menu_controls; }); -__webpack_require__.d(__webpack_exports__, "BlockTitle", function() { return /* reexport */ BlockTitle; }); -__webpack_require__.d(__webpack_exports__, "BlockToolbar", function() { return /* reexport */ BlockToolbar; }); -__webpack_require__.d(__webpack_exports__, "BlockTools", function() { return /* reexport */ BlockTools; }); -__webpack_require__.d(__webpack_exports__, "CopyHandler", function() { return /* reexport */ copy_handler; }); -__webpack_require__.d(__webpack_exports__, "__unstableUseClipboardHandler", function() { return /* reexport */ useClipboardHandler; }); -__webpack_require__.d(__webpack_exports__, "DefaultBlockAppender", function() { return /* reexport */ default_block_appender; }); -__webpack_require__.d(__webpack_exports__, "__unstableEditorStyles", function() { return /* reexport */ EditorStyles; }); -__webpack_require__.d(__webpack_exports__, "Inserter", function() { return /* reexport */ inserter; }); -__webpack_require__.d(__webpack_exports__, "__experimentalLibrary", function() { return /* reexport */ library; }); -__webpack_require__.d(__webpack_exports__, "__experimentalSearchForm", function() { return /* reexport */ search_form; }); -__webpack_require__.d(__webpack_exports__, "BlockEditorKeyboardShortcuts", function() { return /* reexport */ keyboard_shortcuts; }); -__webpack_require__.d(__webpack_exports__, "MultiSelectScrollIntoView", function() { return /* reexport */ MultiSelectScrollIntoView; }); -__webpack_require__.d(__webpack_exports__, "NavigableToolbar", function() { return /* reexport */ navigable_toolbar; }); -__webpack_require__.d(__webpack_exports__, "ObserveTyping", function() { return /* reexport */ observe_typing; }); -__webpack_require__.d(__webpack_exports__, "__unstableUseTypingObserver", function() { return /* reexport */ useTypingObserver; }); -__webpack_require__.d(__webpack_exports__, "__unstableUseMouseMoveTypingReset", function() { return /* reexport */ useMouseMoveTypingReset; }); -__webpack_require__.d(__webpack_exports__, "PreserveScrollInReorder", function() { return /* reexport */ PreserveScrollInReorder; }); -__webpack_require__.d(__webpack_exports__, "SkipToSelectedBlock", function() { return /* reexport */ skip_to_selected_block; }); -__webpack_require__.d(__webpack_exports__, "Typewriter", function() { return /* reexport */ typewriter; }); -__webpack_require__.d(__webpack_exports__, "__unstableUseTypewriter", function() { return /* reexport */ useTypewriter; }); -__webpack_require__.d(__webpack_exports__, "Warning", function() { return /* reexport */ warning; }); -__webpack_require__.d(__webpack_exports__, "WritingFlow", function() { return /* reexport */ writing_flow; }); -__webpack_require__.d(__webpack_exports__, "__unstableUseCanvasClickRedirect", function() { return /* reexport */ useCanvasClickRedirect; }); -__webpack_require__.d(__webpack_exports__, "useBlockDisplayInformation", function() { return /* reexport */ useBlockDisplayInformation; }); -__webpack_require__.d(__webpack_exports__, "__unstableIframe", function() { return /* reexport */ iframe; }); -__webpack_require__.d(__webpack_exports__, "__experimentalUseNoRecursiveRenders", function() { return /* reexport */ useNoRecursiveRenders; }); -__webpack_require__.d(__webpack_exports__, "BlockEditorProvider", function() { return /* reexport */ provider; }); -__webpack_require__.d(__webpack_exports__, "__experimentalUseSimulatedMediaQuery", function() { return /* reexport */ useSimulatedMediaQuery; }); -__webpack_require__.d(__webpack_exports__, "useSetting", function() { return /* reexport */ useSetting; }); -__webpack_require__.d(__webpack_exports__, "transformStyles", function() { return /* reexport */ transform_styles; }); -__webpack_require__.d(__webpack_exports__, "validateThemeColors", function() { return /* reexport */ validateThemeColors; }); -__webpack_require__.d(__webpack_exports__, "validateThemeGradients", function() { return /* reexport */ validateThemeGradients; }); -__webpack_require__.d(__webpack_exports__, "__experimentalGetMatchingVariation", function() { return /* reexport */ __experimentalGetMatchingVariation; }); -__webpack_require__.d(__webpack_exports__, "storeConfig", function() { return /* reexport */ storeConfig; }); -__webpack_require__.d(__webpack_exports__, "store", function() { return /* reexport */ store; }); -__webpack_require__.d(__webpack_exports__, "SETTINGS_DEFAULTS", function() { return /* reexport */ SETTINGS_DEFAULTS; }); +__webpack_require__.d(__webpack_exports__, { + "AlignmentControl": function() { return /* reexport */ AlignmentControl; }, + "AlignmentToolbar": function() { return /* reexport */ AlignmentToolbar; }, + "Autocomplete": function() { return /* reexport */ autocomplete; }, + "BlockAlignmentControl": function() { return /* reexport */ BlockAlignmentControl; }, + "BlockAlignmentToolbar": function() { return /* reexport */ BlockAlignmentToolbar; }, + "BlockBreadcrumb": function() { return /* reexport */ block_breadcrumb; }, + "BlockColorsStyleSelector": function() { return /* reexport */ color_style_selector; }, + "BlockContextProvider": function() { return /* reexport */ BlockContextProvider; }, + "BlockControls": function() { return /* reexport */ block_controls; }, + "BlockEdit": function() { return /* reexport */ BlockEdit; }, + "BlockEditorKeyboardShortcuts": function() { return /* reexport */ keyboard_shortcuts; }, + "BlockEditorProvider": function() { return /* reexport */ provider; }, + "BlockFormatControls": function() { return /* reexport */ BlockFormatControls; }, + "BlockIcon": function() { return /* reexport */ block_icon; }, + "BlockInspector": function() { return /* reexport */ block_inspector; }, + "BlockList": function() { return /* reexport */ BlockList; }, + "BlockMover": function() { return /* reexport */ block_mover; }, + "BlockNavigationDropdown": function() { return /* reexport */ dropdown; }, + "BlockPreview": function() { return /* reexport */ block_preview; }, + "BlockSelectionClearer": function() { return /* reexport */ BlockSelectionClearer; }, + "BlockSettingsMenu": function() { return /* reexport */ block_settings_menu; }, + "BlockSettingsMenuControls": function() { return /* reexport */ block_settings_menu_controls; }, + "BlockStyles": function() { return /* reexport */ block_styles; }, + "BlockTitle": function() { return /* reexport */ BlockTitle; }, + "BlockToolbar": function() { return /* reexport */ block_toolbar; }, + "BlockTools": function() { return /* reexport */ BlockTools; }, + "BlockVerticalAlignmentControl": function() { return /* reexport */ BlockVerticalAlignmentControl; }, + "BlockVerticalAlignmentToolbar": function() { return /* reexport */ BlockVerticalAlignmentToolbar; }, + "ButtonBlockAppender": function() { return /* reexport */ button_block_appender; }, + "ButtonBlockerAppender": function() { return /* reexport */ ButtonBlockerAppender; }, + "ColorPalette": function() { return /* reexport */ color_palette; }, + "ColorPaletteControl": function() { return /* reexport */ ColorPaletteControl; }, + "ContrastChecker": function() { return /* reexport */ contrast_checker; }, + "CopyHandler": function() { return /* reexport */ copy_handler; }, + "DefaultBlockAppender": function() { return /* reexport */ default_block_appender; }, + "FontSizePicker": function() { return /* reexport */ font_size_picker; }, + "InnerBlocks": function() { return /* reexport */ inner_blocks; }, + "Inserter": function() { return /* reexport */ inserter; }, + "InspectorAdvancedControls": function() { return /* reexport */ InspectorAdvancedControls; }, + "InspectorControls": function() { return /* reexport */ inspector_controls; }, + "JustifyContentControl": function() { return /* reexport */ JustifyContentControl; }, + "JustifyToolbar": function() { return /* reexport */ JustifyToolbar; }, + "LineHeightControl": function() { return /* reexport */ line_height_control; }, + "MediaPlaceholder": function() { return /* reexport */ media_placeholder; }, + "MediaReplaceFlow": function() { return /* reexport */ media_replace_flow; }, + "MediaUpload": function() { return /* reexport */ media_upload; }, + "MediaUploadCheck": function() { return /* reexport */ media_upload_check; }, + "MultiSelectScrollIntoView": function() { return /* reexport */ MultiSelectScrollIntoView; }, + "NavigableToolbar": function() { return /* reexport */ navigable_toolbar; }, + "ObserveTyping": function() { return /* reexport */ observe_typing; }, + "PanelColorSettings": function() { return /* reexport */ panel_color_settings; }, + "PlainText": function() { return /* reexport */ plain_text; }, + "RichText": function() { return /* reexport */ rich_text; }, + "RichTextShortcut": function() { return /* reexport */ RichTextShortcut; }, + "RichTextToolbarButton": function() { return /* reexport */ RichTextToolbarButton; }, + "SETTINGS_DEFAULTS": function() { return /* reexport */ SETTINGS_DEFAULTS; }, + "SkipToSelectedBlock": function() { return /* reexport */ skip_to_selected_block; }, + "ToolSelector": function() { return /* reexport */ tool_selector; }, + "Typewriter": function() { return /* reexport */ typewriter; }, + "URLInput": function() { return /* reexport */ url_input; }, + "URLInputButton": function() { return /* reexport */ url_input_button; }, + "URLPopover": function() { return /* reexport */ url_popover; }, + "Warning": function() { return /* reexport */ warning; }, + "WritingFlow": function() { return /* reexport */ writing_flow; }, + "__experimentalBlockAlignmentMatrixControl": function() { return /* reexport */ block_alignment_matrix_control; }, + "__experimentalBlockContentOverlay": function() { return /* reexport */ BlockContentOverlay; }, + "__experimentalBlockFullHeightAligmentControl": function() { return /* reexport */ block_full_height_alignment_control; }, + "__experimentalBlockPatternSetup": function() { return /* reexport */ block_pattern_setup; }, + "__experimentalBlockPatternsList": function() { return /* reexport */ block_patterns_list; }, + "__experimentalBlockVariationPicker": function() { return /* reexport */ block_variation_picker; }, + "__experimentalBlockVariationTransforms": function() { return /* reexport */ block_variation_transforms; }, + "__experimentalBorderRadiusControl": function() { return /* reexport */ BorderRadiusControl; }, + "__experimentalBorderStyleControl": function() { return /* reexport */ BorderStyleControl; }, + "__experimentalColorGradientControl": function() { return /* reexport */ control; }, + "__experimentalColorGradientSettingsDropdown": function() { return /* reexport */ ColorGradientSettingsDropdown; }, + "__experimentalDateFormatPicker": function() { return /* reexport */ DateFormatPicker; }, + "__experimentalDuotoneControl": function() { return /* reexport */ duotone_control; }, + "__experimentalFontAppearanceControl": function() { return /* reexport */ FontAppearanceControl; }, + "__experimentalFontFamilyControl": function() { return /* reexport */ FontFamilyControl; }, + "__experimentalGetBorderClassesAndStyles": function() { return /* reexport */ getBorderClassesAndStyles; }, + "__experimentalGetColorClassesAndStyles": function() { return /* reexport */ getColorClassesAndStyles; }, + "__experimentalGetGradientClass": function() { return /* reexport */ __experimentalGetGradientClass; }, + "__experimentalGetGradientObjectByGradientValue": function() { return /* reexport */ __experimentalGetGradientObjectByGradientValue; }, + "__experimentalGetMatchingVariation": function() { return /* reexport */ __experimentalGetMatchingVariation; }, + "__experimentalGetSpacingClassesAndStyles": function() { return /* reexport */ getSpacingClassesAndStyles; }, + "__experimentalImageEditingProvider": function() { return /* reexport */ ImageEditingProvider; }, + "__experimentalImageEditor": function() { return /* reexport */ ImageEditor; }, + "__experimentalImageSizeControl": function() { return /* reexport */ ImageSizeControl; }, + "__experimentalImageURLInputUI": function() { return /* reexport */ ImageURLInputUI; }, + "__experimentalLayoutStyle": function() { return /* reexport */ LayoutStyle; }, + "__experimentalLetterSpacingControl": function() { return /* reexport */ LetterSpacingControl; }, + "__experimentalLibrary": function() { return /* reexport */ library; }, + "__experimentalLinkControl": function() { return /* reexport */ link_control; }, + "__experimentalLinkControlSearchInput": function() { return /* reexport */ search_input; }, + "__experimentalLinkControlSearchItem": function() { return /* reexport */ search_item; }, + "__experimentalLinkControlSearchResults": function() { return /* reexport */ LinkControlSearchResults; }, + "__experimentalListView": function() { return /* reexport */ components_list_view; }, + "__experimentalPanelColorGradientSettings": function() { return /* reexport */ panel_color_gradient_settings; }, + "__experimentalPreviewOptions": function() { return /* reexport */ PreviewOptions; }, + "__experimentalResponsiveBlockControl": function() { return /* reexport */ responsive_block_control; }, + "__experimentalTextDecorationControl": function() { return /* reexport */ TextDecorationControl; }, + "__experimentalTextTransformControl": function() { return /* reexport */ TextTransformControl; }, + "__experimentalToolsPanelColorDropdown": function() { return /* reexport */ ToolsPanelColorDropdown; }, + "__experimentalUnitControl": function() { return /* reexport */ UnitControl; }, + "__experimentalUseBlockPreview": function() { return /* reexport */ useBlockPreview; }, + "__experimentalUseBorderProps": function() { return /* reexport */ useBorderProps; }, + "__experimentalUseColorProps": function() { return /* reexport */ useColorProps; }, + "__experimentalUseCustomSides": function() { return /* reexport */ useCustomSides; }, + "__experimentalUseGradient": function() { return /* reexport */ __experimentalUseGradient; }, + "__experimentalUseNoRecursiveRenders": function() { return /* reexport */ useNoRecursiveRenders; }, + "__experimentalUseResizeCanvas": function() { return /* reexport */ useResizeCanvas; }, + "__unstableBlockNameContext": function() { return /* reexport */ block_name_context; }, + "__unstableBlockSettingsMenuFirstItem": function() { return /* reexport */ block_settings_menu_first_item; }, + "__unstableBlockToolbarLastItem": function() { return /* reexport */ block_toolbar_last_item; }, + "__unstableEditorStyles": function() { return /* reexport */ EditorStyles; }, + "__unstableIframe": function() { return /* reexport */ iframe; }, + "__unstableInserterMenuExtension": function() { return /* reexport */ inserter_menu_extension; }, + "__unstablePresetDuotoneFilter": function() { return /* reexport */ PresetDuotoneFilter; }, + "__unstableRichTextInputEvent": function() { return /* reexport */ __unstableRichTextInputEvent; }, + "__unstableUseBlockSelectionClearer": function() { return /* reexport */ useBlockSelectionClearer; }, + "__unstableUseClipboardHandler": function() { return /* reexport */ useClipboardHandler; }, + "__unstableUseMouseMoveTypingReset": function() { return /* reexport */ useMouseMoveTypingReset; }, + "__unstableUseTypewriter": function() { return /* reexport */ useTypewriter; }, + "__unstableUseTypingObserver": function() { return /* reexport */ useTypingObserver; }, + "createCustomColorsHOC": function() { return /* reexport */ createCustomColorsHOC; }, + "getColorClassName": function() { return /* reexport */ getColorClassName; }, + "getColorObjectByAttributeValues": function() { return /* reexport */ getColorObjectByAttributeValues; }, + "getColorObjectByColorValue": function() { return /* reexport */ getColorObjectByColorValue; }, + "getFontSize": function() { return /* reexport */ getFontSize; }, + "getFontSizeClass": function() { return /* reexport */ getFontSizeClass; }, + "getFontSizeObjectByValue": function() { return /* reexport */ getFontSizeObjectByValue; }, + "getGradientSlugByValue": function() { return /* reexport */ getGradientSlugByValue; }, + "getGradientValueBySlug": function() { return /* reexport */ getGradientValueBySlug; }, + "getPxFromCssUnit": function() { return /* reexport */ parse_css_unit_to_px; }, + "store": function() { return /* reexport */ store; }, + "storeConfig": function() { return /* reexport */ storeConfig; }, + "transformStyles": function() { return /* reexport */ transform_styles; }, + "useBlockDisplayInformation": function() { return /* reexport */ useBlockDisplayInformation; }, + "useBlockEditContext": function() { return /* reexport */ useBlockEditContext; }, + "useBlockProps": function() { return /* reexport */ useBlockProps; }, + "useCachedTruthy": function() { return /* reexport */ useCachedTruthy; }, + "useInnerBlocksProps": function() { return /* reexport */ useInnerBlocksProps; }, + "useSetting": function() { return /* reexport */ useSetting; }, + "withColorContext": function() { return /* reexport */ with_color_context; }, + "withColors": function() { return /* reexport */ withColors; }, + "withFontSizes": function() { return /* reexport */ with_font_sizes; } +}); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); -__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 selectors_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, "__unstableGetBlockWithBlockTree", function() { return __unstableGetBlockWithBlockTree; }); -__webpack_require__.d(selectors_namespaceObject, "__unstableGetBlockTree", function() { return __unstableGetBlockTree; }); -__webpack_require__.d(selectors_namespaceObject, "__unstableGetClientIdWithClientIdsTree", function() { return selectors_unstableGetClientIdWithClientIdsTree; }); -__webpack_require__.d(selectors_namespaceObject, "__unstableGetClientIdsTree", function() { return selectors_unstableGetClientIdsTree; }); -__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 selectors_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, "getSelectionStart", function() { return selectors_getSelectionStart; }); -__webpack_require__.d(selectors_namespaceObject, "getSelectionEnd", function() { return selectors_getSelectionEnd; }); -__webpack_require__.d(selectors_namespaceObject, "getBlockSelectionStart", function() { return selectors_getBlockSelectionStart; }); -__webpack_require__.d(selectors_namespaceObject, "getBlockSelectionEnd", function() { return selectors_getBlockSelectionEnd; }); -__webpack_require__.d(selectors_namespaceObject, "getSelectedBlockCount", function() { return selectors_getSelectedBlockCount; }); -__webpack_require__.d(selectors_namespaceObject, "hasSelectedBlock", function() { return selectors_hasSelectedBlock; }); -__webpack_require__.d(selectors_namespaceObject, "getSelectedBlockClientId", function() { return selectors_getSelectedBlockClientId; }); -__webpack_require__.d(selectors_namespaceObject, "getSelectedBlock", function() { return selectors_getSelectedBlock; }); -__webpack_require__.d(selectors_namespaceObject, "getBlockRootClientId", function() { return selectors_getBlockRootClientId; }); -__webpack_require__.d(selectors_namespaceObject, "getBlockParents", function() { return selectors_getBlockParents; }); -__webpack_require__.d(selectors_namespaceObject, "getBlockParentsByBlockName", function() { return getBlockParentsByBlockName; }); -__webpack_require__.d(selectors_namespaceObject, "getBlockHierarchyRootClientId", function() { return selectors_getBlockHierarchyRootClientId; }); -__webpack_require__.d(selectors_namespaceObject, "getLowestCommonAncestorWithSelectedBlock", function() { return getLowestCommonAncestorWithSelectedBlock; }); -__webpack_require__.d(selectors_namespaceObject, "getAdjacentBlockClientId", function() { return getAdjacentBlockClientId; }); -__webpack_require__.d(selectors_namespaceObject, "getPreviousBlockClientId", function() { return selectors_getPreviousBlockClientId; }); -__webpack_require__.d(selectors_namespaceObject, "getNextBlockClientId", function() { return selectors_getNextBlockClientId; }); -__webpack_require__.d(selectors_namespaceObject, "getSelectedBlocksInitialCaretPosition", function() { return selectors_getSelectedBlocksInitialCaretPosition; }); -__webpack_require__.d(selectors_namespaceObject, "getSelectedBlockClientIds", function() { return selectors_getSelectedBlockClientIds; }); -__webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlockClientIds", function() { return selectors_getMultiSelectedBlockClientIds; }); -__webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocks", function() { return selectors_getMultiSelectedBlocks; }); -__webpack_require__.d(selectors_namespaceObject, "getFirstMultiSelectedBlockClientId", function() { return selectors_getFirstMultiSelectedBlockClientId; }); -__webpack_require__.d(selectors_namespaceObject, "getLastMultiSelectedBlockClientId", function() { return selectors_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 selectors_getMultiSelectedBlocksStartClientId; }); -__webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocksEndClientId", function() { return selectors_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, "isDraggingBlocks", function() { return isDraggingBlocks; }); -__webpack_require__.d(selectors_namespaceObject, "getDraggedBlockClientIds", function() { return selectors_getDraggedBlockClientIds; }); -__webpack_require__.d(selectors_namespaceObject, "isBlockBeingDragged", function() { return selectors_isBlockBeingDragged; }); -__webpack_require__.d(selectors_namespaceObject, "isAncestorBeingDragged", function() { return selectors_isAncestorBeingDragged; }); -__webpack_require__.d(selectors_namespaceObject, "isCaretWithinFormattedText", function() { return selectors_isCaretWithinFormattedText; }); -__webpack_require__.d(selectors_namespaceObject, "getBlockInsertionPoint", function() { return selectors_getBlockInsertionPoint; }); -__webpack_require__.d(selectors_namespaceObject, "isBlockInsertionPointVisible", function() { return selectors_isBlockInsertionPointVisible; }); -__webpack_require__.d(selectors_namespaceObject, "isValidTemplate", function() { return selectors_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, "canInsertBlockType", function() { return selectors_canInsertBlockType; }); -__webpack_require__.d(selectors_namespaceObject, "canInsertBlocks", function() { return selectors_canInsertBlocks; }); -__webpack_require__.d(selectors_namespaceObject, "getInserterItems", function() { return selectors_getInserterItems; }); -__webpack_require__.d(selectors_namespaceObject, "getBlockTransformItems", function() { return selectors_getBlockTransformItems; }); -__webpack_require__.d(selectors_namespaceObject, "hasInserterItems", function() { return selectors_hasInserterItems; }); -__webpack_require__.d(selectors_namespaceObject, "__experimentalGetAllowedBlocks", function() { return selectors_experimentalGetAllowedBlocks; }); -__webpack_require__.d(selectors_namespaceObject, "__experimentalGetParsedPattern", function() { return __experimentalGetParsedPattern; }); -__webpack_require__.d(selectors_namespaceObject, "__experimentalGetAllowedPatterns", function() { return selectors_experimentalGetAllowedPatterns; }); -__webpack_require__.d(selectors_namespaceObject, "__experimentalGetPatternsByBlockTypes", function() { return selectors_experimentalGetPatternsByBlockTypes; }); -__webpack_require__.d(selectors_namespaceObject, "__experimentalGetPatternTransformItems", function() { return selectors_experimentalGetPatternTransformItems; }); -__webpack_require__.d(selectors_namespaceObject, "getBlockListSettings", function() { return selectors_getBlockListSettings; }); -__webpack_require__.d(selectors_namespaceObject, "getSettings", function() { return selectors_getSettings; }); -__webpack_require__.d(selectors_namespaceObject, "isLastBlockChangePersistent", function() { return selectors_isLastBlockChangePersistent; }); -__webpack_require__.d(selectors_namespaceObject, "__experimentalGetBlockListSettingsForBlocks", function() { return selectors_experimentalGetBlockListSettingsForBlocks; }); -__webpack_require__.d(selectors_namespaceObject, "__experimentalGetParsedReusableBlock", function() { return __experimentalGetParsedReusableBlock; }); -__webpack_require__.d(selectors_namespaceObject, "__experimentalGetReusableBlockTitle", function() { return selectors_experimentalGetReusableBlockTitle; }); -__webpack_require__.d(selectors_namespaceObject, "__unstableIsLastBlockChangeIgnored", function() { return selectors_unstableIsLastBlockChangeIgnored; }); -__webpack_require__.d(selectors_namespaceObject, "__experimentalGetLastBlockAttributeChanges", function() { return __experimentalGetLastBlockAttributeChanges; }); -__webpack_require__.d(selectors_namespaceObject, "isNavigationMode", function() { return selectors_isNavigationMode; }); -__webpack_require__.d(selectors_namespaceObject, "hasBlockMovingClientId", function() { return selectors_hasBlockMovingClientId; }); -__webpack_require__.d(selectors_namespaceObject, "didAutomaticChange", function() { return selectors_didAutomaticChange; }); -__webpack_require__.d(selectors_namespaceObject, "isBlockHighlighted", function() { return selectors_isBlockHighlighted; }); -__webpack_require__.d(selectors_namespaceObject, "areInnerBlocksControlled", function() { return areInnerBlocksControlled; }); -__webpack_require__.d(selectors_namespaceObject, "__experimentalGetActiveBlockIdByBlockNames", function() { return __experimentalGetActiveBlockIdByBlockNames; }); -__webpack_require__.d(selectors_namespaceObject, "wasBlockJustInserted", function() { return wasBlockJustInserted; }); +__webpack_require__.d(selectors_namespaceObject, { + "__experimentalGetActiveBlockIdByBlockNames": function() { return __experimentalGetActiveBlockIdByBlockNames; }, + "__experimentalGetAllowedBlocks": function() { return __experimentalGetAllowedBlocks; }, + "__experimentalGetAllowedPatterns": function() { return __experimentalGetAllowedPatterns; }, + "__experimentalGetBlockListSettingsForBlocks": function() { return __experimentalGetBlockListSettingsForBlocks; }, + "__experimentalGetDirectInsertBlock": function() { return __experimentalGetDirectInsertBlock; }, + "__experimentalGetGlobalBlocksByName": function() { return __experimentalGetGlobalBlocksByName; }, + "__experimentalGetLastBlockAttributeChanges": function() { return __experimentalGetLastBlockAttributeChanges; }, + "__experimentalGetParsedPattern": function() { return __experimentalGetParsedPattern; }, + "__experimentalGetPatternTransformItems": function() { return __experimentalGetPatternTransformItems; }, + "__experimentalGetPatternsByBlockTypes": function() { return __experimentalGetPatternsByBlockTypes; }, + "__experimentalGetReusableBlockTitle": function() { return __experimentalGetReusableBlockTitle; }, + "__unstableGetBlockWithoutInnerBlocks": function() { return __unstableGetBlockWithoutInnerBlocks; }, + "__unstableGetClientIdWithClientIdsTree": function() { return __unstableGetClientIdWithClientIdsTree; }, + "__unstableGetClientIdsTree": function() { return __unstableGetClientIdsTree; }, + "__unstableGetSelectedBlocksWithPartialSelection": function() { return __unstableGetSelectedBlocksWithPartialSelection; }, + "__unstableIsFullySelected": function() { return __unstableIsFullySelected; }, + "__unstableIsLastBlockChangeIgnored": function() { return __unstableIsLastBlockChangeIgnored; }, + "__unstableIsSelectionCollapsed": function() { return __unstableIsSelectionCollapsed; }, + "__unstableIsSelectionMergeable": function() { return __unstableIsSelectionMergeable; }, + "areInnerBlocksControlled": function() { return areInnerBlocksControlled; }, + "canInsertBlockType": function() { return canInsertBlockType; }, + "canInsertBlocks": function() { return canInsertBlocks; }, + "canLockBlockType": function() { return canLockBlockType; }, + "canMoveBlock": function() { return canMoveBlock; }, + "canMoveBlocks": function() { return canMoveBlocks; }, + "canRemoveBlock": function() { return canRemoveBlock; }, + "canRemoveBlocks": function() { return canRemoveBlocks; }, + "didAutomaticChange": function() { return didAutomaticChange; }, + "getAdjacentBlockClientId": function() { return getAdjacentBlockClientId; }, + "getBlock": function() { return getBlock; }, + "getBlockAttributes": function() { return getBlockAttributes; }, + "getBlockCount": function() { return getBlockCount; }, + "getBlockHierarchyRootClientId": function() { return getBlockHierarchyRootClientId; }, + "getBlockIndex": function() { return getBlockIndex; }, + "getBlockInsertionPoint": function() { return getBlockInsertionPoint; }, + "getBlockListSettings": function() { return getBlockListSettings; }, + "getBlockMode": function() { return getBlockMode; }, + "getBlockName": function() { return getBlockName; }, + "getBlockOrder": function() { return getBlockOrder; }, + "getBlockParents": function() { return getBlockParents; }, + "getBlockParentsByBlockName": function() { return getBlockParentsByBlockName; }, + "getBlockRootClientId": function() { return getBlockRootClientId; }, + "getBlockSelectionEnd": function() { return getBlockSelectionEnd; }, + "getBlockSelectionStart": function() { return getBlockSelectionStart; }, + "getBlockTransformItems": function() { return getBlockTransformItems; }, + "getBlocks": function() { return getBlocks; }, + "getBlocksByClientId": function() { return getBlocksByClientId; }, + "getClientIdsOfDescendants": function() { return getClientIdsOfDescendants; }, + "getClientIdsWithDescendants": function() { return getClientIdsWithDescendants; }, + "getDraggedBlockClientIds": function() { return getDraggedBlockClientIds; }, + "getFirstMultiSelectedBlockClientId": function() { return getFirstMultiSelectedBlockClientId; }, + "getGlobalBlockCount": function() { return getGlobalBlockCount; }, + "getInserterItems": function() { return getInserterItems; }, + "getLastMultiSelectedBlockClientId": function() { return getLastMultiSelectedBlockClientId; }, + "getLowestCommonAncestorWithSelectedBlock": function() { return getLowestCommonAncestorWithSelectedBlock; }, + "getMultiSelectedBlockClientIds": function() { return getMultiSelectedBlockClientIds; }, + "getMultiSelectedBlocks": function() { return getMultiSelectedBlocks; }, + "getMultiSelectedBlocksEndClientId": function() { return getMultiSelectedBlocksEndClientId; }, + "getMultiSelectedBlocksStartClientId": function() { return getMultiSelectedBlocksStartClientId; }, + "getNextBlockClientId": function() { return getNextBlockClientId; }, + "getPreviousBlockClientId": function() { return getPreviousBlockClientId; }, + "getSelectedBlock": function() { return getSelectedBlock; }, + "getSelectedBlockClientId": function() { return getSelectedBlockClientId; }, + "getSelectedBlockClientIds": function() { return getSelectedBlockClientIds; }, + "getSelectedBlockCount": function() { return getSelectedBlockCount; }, + "getSelectedBlocksInitialCaretPosition": function() { return getSelectedBlocksInitialCaretPosition; }, + "getSelectionEnd": function() { return getSelectionEnd; }, + "getSelectionStart": function() { return getSelectionStart; }, + "getSettings": function() { return getSettings; }, + "getTemplate": function() { return getTemplate; }, + "getTemplateLock": function() { return getTemplateLock; }, + "hasBlockMovingClientId": function() { return selectors_hasBlockMovingClientId; }, + "hasInserterItems": function() { return hasInserterItems; }, + "hasMultiSelection": function() { return hasMultiSelection; }, + "hasSelectedBlock": function() { return hasSelectedBlock; }, + "hasSelectedInnerBlock": function() { return hasSelectedInnerBlock; }, + "isAncestorBeingDragged": function() { return isAncestorBeingDragged; }, + "isAncestorMultiSelected": function() { return isAncestorMultiSelected; }, + "isBlockBeingDragged": function() { return isBlockBeingDragged; }, + "isBlockHighlighted": function() { return isBlockHighlighted; }, + "isBlockInsertionPointVisible": function() { return isBlockInsertionPointVisible; }, + "isBlockMultiSelected": function() { return isBlockMultiSelected; }, + "isBlockSelected": function() { return isBlockSelected; }, + "isBlockValid": function() { return isBlockValid; }, + "isBlockWithinSelection": function() { return isBlockWithinSelection; }, + "isCaretWithinFormattedText": function() { return selectors_isCaretWithinFormattedText; }, + "isDraggingBlocks": function() { return isDraggingBlocks; }, + "isFirstMultiSelectedBlock": function() { return isFirstMultiSelectedBlock; }, + "isLastBlockChangePersistent": function() { return isLastBlockChangePersistent; }, + "isMultiSelecting": function() { return selectors_isMultiSelecting; }, + "isNavigationMode": function() { return selectors_isNavigationMode; }, + "isSelectionEnabled": function() { return selectors_isSelectionEnabled; }, + "isTyping": function() { return selectors_isTyping; }, + "isValidTemplate": function() { return isValidTemplate; }, + "wasBlockJustInserted": function() { return wasBlockJustInserted; } +}); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); -__webpack_require__.d(actions_namespaceObject, "resetBlocks", function() { return actions_resetBlocks; }); -__webpack_require__.d(actions_namespaceObject, "validateBlocksToTemplate", function() { return validateBlocksToTemplate; }); -__webpack_require__.d(actions_namespaceObject, "resetSelection", function() { return actions_resetSelection; }); -__webpack_require__.d(actions_namespaceObject, "receiveBlocks", function() { return receiveBlocks; }); -__webpack_require__.d(actions_namespaceObject, "updateBlockAttributes", function() { return actions_updateBlockAttributes; }); -__webpack_require__.d(actions_namespaceObject, "updateBlock", function() { return actions_updateBlock; }); -__webpack_require__.d(actions_namespaceObject, "selectBlock", function() { return actions_selectBlock; }); -__webpack_require__.d(actions_namespaceObject, "selectPreviousBlock", function() { return selectPreviousBlock; }); -__webpack_require__.d(actions_namespaceObject, "selectNextBlock", function() { return selectNextBlock; }); -__webpack_require__.d(actions_namespaceObject, "startMultiSelect", function() { return actions_startMultiSelect; }); -__webpack_require__.d(actions_namespaceObject, "stopMultiSelect", function() { return actions_stopMultiSelect; }); -__webpack_require__.d(actions_namespaceObject, "multiSelect", function() { return actions_multiSelect; }); -__webpack_require__.d(actions_namespaceObject, "clearSelectedBlock", function() { return actions_clearSelectedBlock; }); -__webpack_require__.d(actions_namespaceObject, "toggleSelection", function() { return actions_toggleSelection; }); -__webpack_require__.d(actions_namespaceObject, "replaceBlocks", function() { return actions_replaceBlocks; }); -__webpack_require__.d(actions_namespaceObject, "replaceBlock", function() { return actions_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, "moveBlocksToPosition", function() { return actions_moveBlocksToPosition; }); -__webpack_require__.d(actions_namespaceObject, "moveBlockToPosition", function() { return actions_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, "mergeBlocks", function() { return actions_mergeBlocks; }); -__webpack_require__.d(actions_namespaceObject, "removeBlocks", function() { return actions_removeBlocks; }); -__webpack_require__.d(actions_namespaceObject, "removeBlock", function() { return actions_removeBlock; }); -__webpack_require__.d(actions_namespaceObject, "replaceInnerBlocks", function() { return actions_replaceInnerBlocks; }); -__webpack_require__.d(actions_namespaceObject, "toggleBlockMode", function() { return toggleBlockMode; }); -__webpack_require__.d(actions_namespaceObject, "startTyping", function() { return actions_startTyping; }); -__webpack_require__.d(actions_namespaceObject, "stopTyping", function() { return actions_stopTyping; }); -__webpack_require__.d(actions_namespaceObject, "startDraggingBlocks", function() { return actions_startDraggingBlocks; }); -__webpack_require__.d(actions_namespaceObject, "stopDraggingBlocks", function() { return actions_stopDraggingBlocks; }); -__webpack_require__.d(actions_namespaceObject, "enterFormattedText", function() { return actions_enterFormattedText; }); -__webpack_require__.d(actions_namespaceObject, "exitFormattedText", function() { return actions_exitFormattedText; }); -__webpack_require__.d(actions_namespaceObject, "selectionChange", function() { return actions_selectionChange; }); -__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, "updateSettings", function() { return actions_updateSettings; }); -__webpack_require__.d(actions_namespaceObject, "__unstableSaveReusableBlock", function() { return __unstableSaveReusableBlock; }); -__webpack_require__.d(actions_namespaceObject, "__unstableMarkLastChangeAsPersistent", function() { return actions_unstableMarkLastChangeAsPersistent; }); -__webpack_require__.d(actions_namespaceObject, "__unstableMarkNextChangeAsNotPersistent", function() { return actions_unstableMarkNextChangeAsNotPersistent; }); -__webpack_require__.d(actions_namespaceObject, "__unstableMarkAutomaticChange", function() { return actions_unstableMarkAutomaticChange; }); -__webpack_require__.d(actions_namespaceObject, "__unstableMarkAutomaticChangeFinal", function() { return __unstableMarkAutomaticChangeFinal; }); -__webpack_require__.d(actions_namespaceObject, "setNavigationMode", function() { return actions_setNavigationMode; }); -__webpack_require__.d(actions_namespaceObject, "setBlockMovingClientId", function() { return actions_setBlockMovingClientId; }); -__webpack_require__.d(actions_namespaceObject, "duplicateBlocks", function() { return actions_duplicateBlocks; }); -__webpack_require__.d(actions_namespaceObject, "insertBeforeBlock", function() { return actions_insertBeforeBlock; }); -__webpack_require__.d(actions_namespaceObject, "insertAfterBlock", function() { return actions_insertAfterBlock; }); -__webpack_require__.d(actions_namespaceObject, "toggleBlockHighlight", function() { return actions_toggleBlockHighlight; }); -__webpack_require__.d(actions_namespaceObject, "flashBlock", function() { return actions_flashBlock; }); -__webpack_require__.d(actions_namespaceObject, "setHasControlledInnerBlocks", function() { return actions_setHasControlledInnerBlocks; }); - -// EXTERNAL MODULE: external ["wp","richText"] -var external_wp_richText_ = __webpack_require__("qRz9"); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js -var esm_extends = __webpack_require__("wx14"); - -// EXTERNAL MODULE: external ["wp","element"] -var external_wp_element_ = __webpack_require__("GRId"); - +__webpack_require__.d(actions_namespaceObject, { + "__unstableDeleteSelection": function() { return __unstableDeleteSelection; }, + "__unstableExpandSelection": function() { return __unstableExpandSelection; }, + "__unstableMarkAutomaticChange": function() { return __unstableMarkAutomaticChange; }, + "__unstableMarkLastChangeAsPersistent": function() { return __unstableMarkLastChangeAsPersistent; }, + "__unstableMarkNextChangeAsNotPersistent": function() { return __unstableMarkNextChangeAsNotPersistent; }, + "__unstableSaveReusableBlock": function() { return __unstableSaveReusableBlock; }, + "__unstableSplitSelection": function() { return __unstableSplitSelection; }, + "clearSelectedBlock": function() { return clearSelectedBlock; }, + "duplicateBlocks": function() { return duplicateBlocks; }, + "enterFormattedText": function() { return enterFormattedText; }, + "exitFormattedText": function() { return exitFormattedText; }, + "flashBlock": function() { return flashBlock; }, + "hideInsertionPoint": function() { return hideInsertionPoint; }, + "insertAfterBlock": function() { return insertAfterBlock; }, + "insertBeforeBlock": function() { return insertBeforeBlock; }, + "insertBlock": function() { return insertBlock; }, + "insertBlocks": function() { return insertBlocks; }, + "insertDefaultBlock": function() { return insertDefaultBlock; }, + "mergeBlocks": function() { return mergeBlocks; }, + "moveBlockToPosition": function() { return moveBlockToPosition; }, + "moveBlocksDown": function() { return moveBlocksDown; }, + "moveBlocksToPosition": function() { return moveBlocksToPosition; }, + "moveBlocksUp": function() { return moveBlocksUp; }, + "multiSelect": function() { return multiSelect; }, + "receiveBlocks": function() { return receiveBlocks; }, + "removeBlock": function() { return removeBlock; }, + "removeBlocks": function() { return removeBlocks; }, + "replaceBlock": function() { return replaceBlock; }, + "replaceBlocks": function() { return replaceBlocks; }, + "replaceInnerBlocks": function() { return replaceInnerBlocks; }, + "resetBlocks": function() { return resetBlocks; }, + "resetSelection": function() { return resetSelection; }, + "selectBlock": function() { return selectBlock; }, + "selectNextBlock": function() { return selectNextBlock; }, + "selectPreviousBlock": function() { return selectPreviousBlock; }, + "selectionChange": function() { return selectionChange; }, + "setBlockMovingClientId": function() { return setBlockMovingClientId; }, + "setHasControlledInnerBlocks": function() { return setHasControlledInnerBlocks; }, + "setNavigationMode": function() { return setNavigationMode; }, + "setTemplateValidity": function() { return setTemplateValidity; }, + "showInsertionPoint": function() { return showInsertionPoint; }, + "startDraggingBlocks": function() { return startDraggingBlocks; }, + "startMultiSelect": function() { return startMultiSelect; }, + "startTyping": function() { return startTyping; }, + "stopDraggingBlocks": function() { return stopDraggingBlocks; }, + "stopMultiSelect": function() { return stopMultiSelect; }, + "stopTyping": function() { return stopTyping; }, + "synchronizeTemplate": function() { return synchronizeTemplate; }, + "toggleBlockHighlight": function() { return toggleBlockHighlight; }, + "toggleBlockMode": function() { return toggleBlockMode; }, + "toggleSelection": function() { return toggleSelection; }, + "updateBlock": function() { return updateBlock; }, + "updateBlockAttributes": function() { return updateBlockAttributes; }, + "updateBlockListSettings": function() { return updateBlockListSettings; }, + "updateSettings": function() { return updateSettings; }, + "validateBlocksToTemplate": function() { return validateBlocksToTemplate; } +}); + +;// CONCATENATED MODULE: external ["wp","blocks"] +var external_wp_blocks_namespaceObject = window["wp"]["blocks"]; +;// CONCATENATED MODULE: external ["wp","hooks"] +var external_wp_hooks_namespaceObject = window["wp"]["hooks"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/compat.js +/** + * WordPress dependencies + */ + + + +function migrateLightBlockWrapper(settings) { + const { + apiVersion = 1 + } = settings; + + if (apiVersion < 2 && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'lightBlockWrapper', false)) { + settings.apiVersion = 2; + } + + return settings; +} + +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/compat/migrateLightBlockWrapper', migrateLightBlockWrapper); + +;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js +function _extends() { + _extends = Object.assign ? Object.assign.bind() : 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); +} +;// CONCATENATED MODULE: external ["wp","element"] +var external_wp_element_namespaceObject = window["wp"]["element"]; // EXTERNAL MODULE: ./node_modules/classnames/index.js -var classnames = __webpack_require__("TSYQ"); +var classnames = __webpack_require__(4403); var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); - -// EXTERNAL MODULE: external "lodash" -var external_lodash_ = __webpack_require__("YLtl"); - -// EXTERNAL MODULE: external ["wp","compose"] -var external_wp_compose_ = __webpack_require__("K9lf"); - -// EXTERNAL MODULE: external ["wp","hooks"] -var external_wp_hooks_ = __webpack_require__("g56x"); - -// EXTERNAL MODULE: external ["wp","blocks"] -var external_wp_blocks_ = __webpack_require__("HSyU"); - -// EXTERNAL MODULE: external ["wp","components"] -var external_wp_components_ = __webpack_require__("tI+e"); - -// EXTERNAL MODULE: external ["wp","data"] -var external_wp_data_ = __webpack_require__("1ZqX"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-edit/context.js -/** - * WordPress dependencies - */ - -const Context = Object(external_wp_element_["createContext"])({ - name: '', - isSelected: false, - clientId: null -}); -const { - Provider: context_Provider -} = Context; - -/** - * A hook that returns the block edit context. - * - * @return {Object} Block edit context - */ - -function useBlockEditContext() { - return Object(external_wp_element_["useContext"])(Context); -} - -// EXTERNAL MODULE: external ["wp","i18n"] -var external_wp_i18n_ = __webpack_require__("l3Sj"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/defaults.js +;// CONCATENATED MODULE: external "lodash" +var external_lodash_namespaceObject = window["lodash"]; +;// CONCATENATED MODULE: external ["wp","compose"] +var external_wp_compose_namespaceObject = window["wp"]["compose"]; +;// CONCATENATED MODULE: external ["wp","components"] +var external_wp_components_namespaceObject = window["wp"]["components"]; +;// CONCATENATED MODULE: external ["wp","data"] +var external_wp_data_namespaceObject = window["wp"]["data"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/groups.js +/** + * WordPress dependencies + */ + +const BlockControlsDefault = (0,external_wp_components_namespaceObject.createSlotFill)('BlockControls'); +const BlockControlsBlock = (0,external_wp_components_namespaceObject.createSlotFill)('BlockControlsBlock'); +const BlockControlsInline = (0,external_wp_components_namespaceObject.createSlotFill)('BlockFormatControls'); +const BlockControlsOther = (0,external_wp_components_namespaceObject.createSlotFill)('BlockControlsOther'); +const BlockControlsParent = (0,external_wp_components_namespaceObject.createSlotFill)('BlockControlsParent'); +const groups = { + default: BlockControlsDefault, + block: BlockControlsBlock, + inline: BlockControlsInline, + other: BlockControlsOther, + parent: BlockControlsParent +}; +/* harmony default export */ var block_controls_groups = (groups); + +;// CONCATENATED MODULE: external ["wp","i18n"] +var external_wp_i18n_namespaceObject = window["wp"]["i18n"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/defaults.js /** * WordPress dependencies */ @@ -7378,23 +3146,26 @@ * The default editor settings * * @typedef {Object} SETTINGS_DEFAULT - * @property {boolean} alignWide Enable/Disable Wide/Full Alignments - * @property {boolean} supportsLayout Enable/disable layouts support in container blocks. - * @property {boolean} imageEditing Image Editing settings set to false to disable. - * @property {Array} imageSizes Available image sizes - * @property {number} maxWidth Max width to constraint resizing - * @property {boolean|Array} allowedBlockTypes Allowed block types - * @property {boolean} hasFixedToolbar Whether or not the editor toolbar is fixed - * @property {boolean} focusMode Whether the focus mode is enabled or not - * @property {Array} styles Editor Styles - * @property {boolean} keepCaretInsideBlock Whether caret should move between blocks in edit mode - * @property {string} bodyPlaceholder Empty post placeholder - * @property {string} titlePlaceholder Empty title placeholder - * @property {boolean} codeEditingEnabled Whether or not the user can switch to the code editor - * @property {boolean} __experimentalCanUserUseUnfilteredHTML Whether the user should be able to use unfiltered HTML or the HTML should be filtered e.g., to remove elements considered insecure like iframes. - * @property {boolean} __experimentalBlockDirectory Whether the user has enabled the Block Directory - * @property {Array} __experimentalBlockPatterns Array of objects representing the block patterns - * @property {Array} __experimentalBlockPatternCategories Array of objects representing the block pattern categories + * @property {boolean} alignWide Enable/Disable Wide/Full Alignments + * @property {boolean} supportsLayout Enable/disable layouts support in container blocks. + * @property {boolean} imageEditing Image Editing settings set to false to disable. + * @property {Array} imageSizes Available image sizes + * @property {number} maxWidth Max width to constraint resizing + * @property {boolean|Array} allowedBlockTypes Allowed block types + * @property {boolean} hasFixedToolbar Whether or not the editor toolbar is fixed + * @property {boolean} focusMode Whether the focus mode is enabled or not + * @property {Array} styles Editor Styles + * @property {boolean} keepCaretInsideBlock Whether caret should move between blocks in edit mode + * @property {string} bodyPlaceholder Empty post placeholder + * @property {string} titlePlaceholder Empty title placeholder + * @property {boolean} canLockBlocks Whether the user can manage Block Lock state + * @property {boolean} codeEditingEnabled Whether or not the user can switch to the code editor + * @property {boolean} generateAnchors Enable/Disable auto anchor generation for Heading blocks + * @property {boolean} __experimentalCanUserUseUnfilteredHTML Whether the user should be able to use unfiltered HTML or the HTML should be filtered e.g., to remove elements considered insecure like iframes. + * @property {boolean} __experimentalBlockDirectory Whether the user has enabled the Block Directory + * @property {Array} __experimentalBlockPatterns Array of objects representing the block patterns + * @property {Array} __experimentalBlockPatternCategories Array of objects representing the block pattern categories + * @property {boolean} __unstableGalleryWithImageBlocks Whether the user has enabled the refactored gallery block which uses InnerBlocks */ const SETTINGS_DEFAULTS = { @@ -7403,74 +3174,74 @@ // colors setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults. // The setting is only kept for backward compatibility purposes. colors: [{ - name: Object(external_wp_i18n_["__"])('Black'), + name: (0,external_wp_i18n_namespaceObject.__)('Black'), slug: 'black', color: '#000000' }, { - name: Object(external_wp_i18n_["__"])('Cyan bluish gray'), + name: (0,external_wp_i18n_namespaceObject.__)('Cyan bluish gray'), slug: 'cyan-bluish-gray', color: '#abb8c3' }, { - name: Object(external_wp_i18n_["__"])('White'), + name: (0,external_wp_i18n_namespaceObject.__)('White'), slug: 'white', color: '#ffffff' }, { - name: Object(external_wp_i18n_["__"])('Pale pink'), + name: (0,external_wp_i18n_namespaceObject.__)('Pale pink'), slug: 'pale-pink', color: '#f78da7' }, { - name: Object(external_wp_i18n_["__"])('Vivid red'), + name: (0,external_wp_i18n_namespaceObject.__)('Vivid red'), slug: 'vivid-red', color: '#cf2e2e' }, { - name: Object(external_wp_i18n_["__"])('Luminous vivid orange'), + name: (0,external_wp_i18n_namespaceObject.__)('Luminous vivid orange'), slug: 'luminous-vivid-orange', color: '#ff6900' }, { - name: Object(external_wp_i18n_["__"])('Luminous vivid amber'), + name: (0,external_wp_i18n_namespaceObject.__)('Luminous vivid amber'), slug: 'luminous-vivid-amber', color: '#fcb900' }, { - name: Object(external_wp_i18n_["__"])('Light green cyan'), + name: (0,external_wp_i18n_namespaceObject.__)('Light green cyan'), slug: 'light-green-cyan', color: '#7bdcb5' }, { - name: Object(external_wp_i18n_["__"])('Vivid green cyan'), + name: (0,external_wp_i18n_namespaceObject.__)('Vivid green cyan'), slug: 'vivid-green-cyan', color: '#00d084' }, { - name: Object(external_wp_i18n_["__"])('Pale cyan blue'), + name: (0,external_wp_i18n_namespaceObject.__)('Pale cyan blue'), slug: 'pale-cyan-blue', color: '#8ed1fc' }, { - name: Object(external_wp_i18n_["__"])('Vivid cyan blue'), + name: (0,external_wp_i18n_namespaceObject.__)('Vivid cyan blue'), slug: 'vivid-cyan-blue', color: '#0693e3' }, { - name: Object(external_wp_i18n_["__"])('Vivid purple'), + name: (0,external_wp_i18n_namespaceObject.__)('Vivid purple'), slug: 'vivid-purple', color: '#9b51e0' }], // fontSizes setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults. // The setting is only kept for backward compatibility purposes. fontSizes: [{ - name: Object(external_wp_i18n_["_x"])('Small', 'font size name'), + name: (0,external_wp_i18n_namespaceObject._x)('Small', 'font size name'), size: 13, slug: 'small' }, { - name: Object(external_wp_i18n_["_x"])('Normal', 'font size name'), + name: (0,external_wp_i18n_namespaceObject._x)('Normal', 'font size name'), size: 16, slug: 'normal' }, { - name: Object(external_wp_i18n_["_x"])('Medium', 'font size name'), + name: (0,external_wp_i18n_namespaceObject._x)('Medium', 'font size name'), size: 20, slug: 'medium' }, { - name: Object(external_wp_i18n_["_x"])('Large', 'font size name'), + name: (0,external_wp_i18n_namespaceObject._x)('Large', 'font size name'), size: 36, slug: 'large' }, { - name: Object(external_wp_i18n_["_x"])('Huge', 'font size name'), + name: (0,external_wp_i18n_namespaceObject._x)('Huge', 'font size name'), size: 42, slug: 'huge' }], @@ -7478,18 +3249,18 @@ imageDefaultSize: 'large', imageSizes: [{ slug: 'thumbnail', - name: Object(external_wp_i18n_["__"])('Thumbnail') + name: (0,external_wp_i18n_namespaceObject.__)('Thumbnail') }, { slug: 'medium', - name: Object(external_wp_i18n_["__"])('Medium') + name: (0,external_wp_i18n_namespaceObject.__)('Medium') }, { slug: 'large', - name: Object(external_wp_i18n_["__"])('Large') + name: (0,external_wp_i18n_namespaceObject.__)('Large') }, { slug: 'full', - name: Object(external_wp_i18n_["__"])('Full Size') + name: (0,external_wp_i18n_namespaceObject.__)('Full Size') }], - // Allow plugin to disable Image Editor if need be + // Allow plugin to disable Image Editor if need be. imageEditing: true, // 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 @@ -7500,66 +3271,74 @@ maxUploadFileSize: 0, // List of allowed mime types and file extensions. allowedMimeTypes: null, + // Allows to disable block locking interface. + canLockBlocks: true, __experimentalCanUserUseUnfilteredHTML: false, __experimentalBlockDirectory: false, __mobileEnablePageTemplates: false, __experimentalBlockPatterns: [], __experimentalBlockPatternCategories: [], __experimentalSpotlightEntityBlocks: [], + __unstableGalleryWithImageBlocks: false, + generateAnchors: false, // gradients setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults. // The setting is only kept for backward compatibility purposes. gradients: [{ - name: Object(external_wp_i18n_["__"])('Vivid cyan blue to vivid purple'), + name: (0,external_wp_i18n_namespaceObject.__)('Vivid cyan blue to vivid purple'), gradient: 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)', slug: 'vivid-cyan-blue-to-vivid-purple' }, { - name: Object(external_wp_i18n_["__"])('Light green cyan to vivid green cyan'), + name: (0,external_wp_i18n_namespaceObject.__)('Light green cyan to vivid green cyan'), gradient: 'linear-gradient(135deg,rgb(122,220,180) 0%,rgb(0,208,130) 100%)', slug: 'light-green-cyan-to-vivid-green-cyan' }, { - name: Object(external_wp_i18n_["__"])('Luminous vivid amber to luminous vivid orange'), + name: (0,external_wp_i18n_namespaceObject.__)('Luminous vivid amber to luminous vivid orange'), gradient: 'linear-gradient(135deg,rgba(252,185,0,1) 0%,rgba(255,105,0,1) 100%)', slug: 'luminous-vivid-amber-to-luminous-vivid-orange' }, { - name: Object(external_wp_i18n_["__"])('Luminous vivid orange to vivid red'), + name: (0,external_wp_i18n_namespaceObject.__)('Luminous vivid orange to vivid red'), gradient: 'linear-gradient(135deg,rgba(255,105,0,1) 0%,rgb(207,46,46) 100%)', slug: 'luminous-vivid-orange-to-vivid-red' }, { - name: Object(external_wp_i18n_["__"])('Very light gray to cyan bluish gray'), + name: (0,external_wp_i18n_namespaceObject.__)('Very light gray to cyan bluish gray'), gradient: 'linear-gradient(135deg,rgb(238,238,238) 0%,rgb(169,184,195) 100%)', slug: 'very-light-gray-to-cyan-bluish-gray' }, { - name: Object(external_wp_i18n_["__"])('Cool to warm spectrum'), + name: (0,external_wp_i18n_namespaceObject.__)('Cool to warm spectrum'), gradient: 'linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%)', slug: 'cool-to-warm-spectrum' }, { - name: Object(external_wp_i18n_["__"])('Blush light purple'), + name: (0,external_wp_i18n_namespaceObject.__)('Blush light purple'), gradient: 'linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%)', slug: 'blush-light-purple' }, { - name: Object(external_wp_i18n_["__"])('Blush bordeaux'), + name: (0,external_wp_i18n_namespaceObject.__)('Blush bordeaux'), gradient: 'linear-gradient(135deg,rgb(254,205,165) 0%,rgb(254,45,45) 50%,rgb(107,0,62) 100%)', slug: 'blush-bordeaux' }, { - name: Object(external_wp_i18n_["__"])('Luminous dusk'), + name: (0,external_wp_i18n_namespaceObject.__)('Luminous dusk'), gradient: 'linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%)', slug: 'luminous-dusk' }, { - name: Object(external_wp_i18n_["__"])('Pale ocean'), + name: (0,external_wp_i18n_namespaceObject.__)('Pale ocean'), gradient: 'linear-gradient(135deg,rgb(255,245,203) 0%,rgb(182,227,212) 50%,rgb(51,167,181) 100%)', slug: 'pale-ocean' }, { - name: Object(external_wp_i18n_["__"])('Electric grass'), + name: (0,external_wp_i18n_namespaceObject.__)('Electric grass'), gradient: 'linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%)', slug: 'electric-grass' }, { - name: Object(external_wp_i18n_["__"])('Midnight'), + name: (0,external_wp_i18n_namespaceObject.__)('Midnight'), gradient: 'linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%)', slug: 'midnight' - }] -}; - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/array.js + }], + __unstableResolvedAssets: { + styles: [], + scripts: [] + } +}; + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/array.js /** * External dependencies */ @@ -7571,11 +3350,11 @@ * @param {*} elements Elements to insert. * @param {number} index Insert Position. * - * @return {Array} Result. + * @return {Array} Result. */ function insertAt(array, elements, index) { - return [...array.slice(0, index), ...Object(external_lodash_["castArray"])(elements), ...array.slice(index)]; + return [...array.slice(0, index), ...(0,external_lodash_namespaceObject.castArray)(elements), ...array.slice(index)]; } /** * Moves an element in an array. @@ -7585,16 +3364,17 @@ * @param {number} to Destination index. * @param {number} count Number of elements to move. * - * @return {Array} Result. - */ - -function moveTo(array, from, to, count = 1) { + * @return {Array} Result. + */ + +function moveTo(array, from, to) { + let count = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1; const withoutMovedElements = [...array]; withoutMovedElements.splice(from, count); return insertAt(withoutMovedElements, array.slice(from, from + count), to); } -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/reducer.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/reducer.js /** * External dependencies */ @@ -7622,7 +3402,8 @@ * @return {Object} Block order map object. */ -function mapBlockOrder(blocks, rootClientId = '') { +function mapBlockOrder(blocks) { + let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; const result = { [rootClientId]: [] }; @@ -7647,7 +3428,8 @@ */ -function mapBlockParents(blocks, rootClientId = '') { +function mapBlockParents(blocks) { + let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; return blocks.reduce((result, block) => Object.assign(result, { [block.clientId]: rootClientId }, mapBlockParents(block.innerBlocks, block.clientId)), {}); @@ -7657,14 +3439,15 @@ * applying a transformation function to each one. * Returns a flattened object with the transformed blocks. * - * @param {Array} blocks Blocks to flatten. + * @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 = external_lodash_["identity"]) { +function flattenBlocks(blocks) { + let transform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : external_lodash_namespaceObject.identity; const result = {}; const stack = [...blocks]; @@ -7691,7 +3474,7 @@ function getFlattenedBlocksWithoutAttributes(blocks) { - return flattenBlocks(blocks, block => Object(external_lodash_["omit"])(block, 'attributes')); + return flattenBlocks(blocks, block => (0,external_lodash_namespaceObject.omit)(block, 'attributes')); } /** * Given an array of blocks, returns an object containing all block attributes, @@ -7708,38 +3491,6 @@ return flattenBlocks(blocks, block => 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. It also excludes - * InnerBlocks controllers, like template parts. - * - * It is important to exclude the full inner block controller and not just the - * inner blocks because in many cases, we need to persist the previous value of - * an inner block controller. To do so, it must be excluded from the list of - * client IDs which are considered to be part of the top-level entity. - * - * @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 ''. - * @param {?Object} controlledInnerBlocks The InnerBlocks controller state. - * - * @return {Array} List of descendant client IDs. - */ - - -function getNestedBlockClientIds(blocksOrder, rootClientId = '', controlledInnerBlocks = {}) { - return Object(external_lodash_["reduce"])(blocksOrder[rootClientId], (result, clientId) => { - if (!!controlledInnerBlocks[clientId]) { - return result; - } - - return [...result, clientId, ...getNestedBlockClientIds(blocksOrder, clientId)]; - }, []); -} -/** * Returns an object against which it is safe to perform mutating operations, * given the original object and its current working copy. * @@ -7770,7 +3521,7 @@ function hasSameKeys(a, b) { - return Object(external_lodash_["isEqual"])(Object(external_lodash_["keys"])(a), Object(external_lodash_["keys"])(b)); + return (0,external_lodash_namespaceObject.isEqual)((0,external_lodash_namespaceObject.keys)(a), (0,external_lodash_namespaceObject.keys)(b)); } /** * Returns true if, given the currently dispatching action and the previously @@ -7784,25 +3535,82 @@ */ function isUpdatingSameBlockAttribute(action, lastAction) { - return action.type === 'UPDATE_BLOCK_ATTRIBUTES' && lastAction !== undefined && lastAction.type === 'UPDATE_BLOCK_ATTRIBUTES' && Object(external_lodash_["isEqual"])(action.clientIds, lastAction.clientIds) && hasSameKeys(action.attributes, lastAction.attributes); -} -/** - * Utility returning an object with an empty object value for each key. - * - * @param {Array} objectKeys Keys to fill. - * @return {Object} Object filled with empty object as values for each clientId. - */ - -const fillKeysWithEmptyObject = objectKeys => { - return objectKeys.reduce((result, key) => { - result[key] = {}; - return result; - }, {}); -}; -/** - * Higher-order reducer intended to compute a cache key for each block in the post. - * A new instance of the cache key (empty object) is created each time the block object - * needs to be refreshed (for any change in the block or its children). + return action.type === 'UPDATE_BLOCK_ATTRIBUTES' && lastAction !== undefined && lastAction.type === 'UPDATE_BLOCK_ATTRIBUTES' && (0,external_lodash_namespaceObject.isEqual)(action.clientIds, lastAction.clientIds) && hasSameKeys(action.attributes, lastAction.attributes); +} + +function buildBlockTree(state, blocks) { + const result = {}; + const stack = [...blocks]; + const flattenedBlocks = [...blocks]; + + while (stack.length) { + const block = stack.shift(); + stack.push(...block.innerBlocks); + flattenedBlocks.push(...block.innerBlocks); + } // Create objects before mutating them, that way it's always defined. + + + for (const block of flattenedBlocks) { + result[block.clientId] = {}; + } + + for (const block of flattenedBlocks) { + result[block.clientId] = Object.assign(result[block.clientId], { ...state.byClientId[block.clientId], + attributes: state.attributes[block.clientId], + innerBlocks: block.innerBlocks.map(subBlock => result[subBlock.clientId]) + }); + } + + return result; +} + +function updateParentInnerBlocksInTree(state, tree, updatedClientIds) { + let updateChildrenOfUpdatedClientIds = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + const uncontrolledParents = new Set([]); + const controlledParents = new Set(); + + for (const clientId of updatedClientIds) { + let current = updateChildrenOfUpdatedClientIds ? clientId : state.parents[clientId]; + + do { + if (state.controlledInnerBlocks[current]) { + // Should stop on controlled blocks. + // If we reach a controlled parent, break out of the loop. + controlledParents.add(current); + break; + } else { + // Else continue traversing up through parents. + uncontrolledParents.add(current); + current = state.parents[current]; + } + } while (current !== undefined); + } // To make sure the order of assignments doesn't matter, + // we first create empty objects and mutates the inner blocks later. + + + for (const clientId of uncontrolledParents) { + tree[clientId] = { ...tree[clientId] + }; + } + + for (const clientId of uncontrolledParents) { + tree[clientId].innerBlocks = (state.order[clientId] || []).map(subClientId => tree[subClientId]); + } // Controlled parent blocks, need a dedicated key for their inner blocks + // to be used when doing getBlocks( controlledBlockClientId ). + + + for (const clientId of controlledParents) { + tree['controlled||' + clientId] = { + innerBlocks: (state.order[clientId] || []).map(subClientId => tree[subClientId]) + }; + } + + return tree; +} +/** + * Higher-order reducer intended to compute full block objects key for each block in the post. + * This is a denormalization to optimize the performance of the getBlock selectors and avoid + * recomputing the block objects and avoid heavy memoization. * * @param {Function} reducer Original reducer function. * @@ -7810,88 +3618,88 @@ */ -const withBlockCache = reducer => (state = {}, action) => { +const withBlockTree = reducer => function () { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let action = arguments.length > 1 ? arguments[1] : undefined; const newState = reducer(state, action); if (newState === state) { return state; } - newState.cache = state.cache ? state.cache : {}; - /** - * For each clientId provided, traverses up parents, adding the provided clientIds - * and each parent's clientId to the returned array. - * - * When calling this function consider that it uses the old state, so any state - * modifications made by the `reducer` will not be present. - * - * @param {Array} clientIds an Array of block clientIds. - * - * @return {Array} The provided clientIds and all of their parent clientIds. - */ - - const getBlocksWithParentsClientIds = clientIds => { - return clientIds.reduce((result, clientId) => { - let current = clientId; - - do { - result.push(current); - current = state.parents[current]; - } while (current && !state.controlledInnerBlocks[current]); - - return result; - }, []); - }; + newState.tree = state.tree ? state.tree : {}; switch (action.type) { - case 'RESET_BLOCKS': - newState.cache = Object(external_lodash_["mapValues"])(flattenBlocks(action.blocks), () => ({})); - break; - case 'RECEIVE_BLOCKS': case 'INSERT_BLOCKS': { - const updatedBlockUids = Object(external_lodash_["keys"])(flattenBlocks(action.blocks)); - - if (action.rootClientId && !state.controlledInnerBlocks[action.rootClientId]) { - updatedBlockUids.push(action.rootClientId); - } - - newState.cache = { ...newState.cache, - ...fillKeysWithEmptyObject(getBlocksWithParentsClientIds(updatedBlockUids)) - }; + const subTree = buildBlockTree(newState, action.blocks); + newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree, + ...subTree + }, action.rootClientId ? [action.rootClientId] : [''], true); break; } case 'UPDATE_BLOCK': - newState.cache = { ...newState.cache, - ...fillKeysWithEmptyObject(getBlocksWithParentsClientIds([action.clientId])) - }; + newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree, + [action.clientId]: { ...newState.tree[action.clientId], + ...newState.byClientId[action.clientId], + attributes: newState.attributes[action.clientId] + } + }, [action.clientId], false); break; case 'UPDATE_BLOCK_ATTRIBUTES': - newState.cache = { ...newState.cache, - ...fillKeysWithEmptyObject(getBlocksWithParentsClientIds(action.clientIds)) - }; - break; + { + const newSubTree = action.clientIds.reduce((result, clientId) => { + result[clientId] = { ...newState.tree[clientId], + attributes: newState.attributes[clientId] + }; + return result; + }, {}); + newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree, + ...newSubTree + }, action.clientIds, false); + break; + } case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN': - const parentClientIds = fillKeysWithEmptyObject(getBlocksWithParentsClientIds(action.replacedClientIds)); - newState.cache = { ...Object(external_lodash_["omit"])(newState.cache, action.replacedClientIds), - ...Object(external_lodash_["omit"])(parentClientIds, action.replacedClientIds), - ...fillKeysWithEmptyObject(Object(external_lodash_["keys"])(flattenBlocks(action.blocks))) - }; - break; + { + const subTree = buildBlockTree(newState, action.blocks); + newState.tree = updateParentInnerBlocksInTree(newState, { ...(0,external_lodash_namespaceObject.omit)(newState.tree, action.replacedClientIds.concat( // Controlled inner blocks are only removed + // if the block doesn't move to another position + // otherwise their content will be lost. + action.replacedClientIds.filter(clientId => !subTree[clientId]).map(clientId => 'controlled||' + clientId))), + ...subTree + }, action.blocks.map(b => b.clientId), false); // If there are no replaced blocks, it means we're removing blocks so we need to update their parent. + + const parentsOfRemovedBlocks = []; + + for (const clientId of action.clientIds) { + if (state.parents[clientId] !== undefined && (state.parents[clientId] === '' || newState.byClientId[state.parents[clientId]])) { + parentsOfRemovedBlocks.push(state.parents[clientId]); + } + } + + newState.tree = updateParentInnerBlocksInTree(newState, newState.tree, parentsOfRemovedBlocks, true); + break; + } case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN': - newState.cache = { ...Object(external_lodash_["omit"])(newState.cache, action.removedClientIds), - ...fillKeysWithEmptyObject(Object(external_lodash_["difference"])(getBlocksWithParentsClientIds(action.clientIds), action.clientIds)) - }; + const parentsOfRemovedBlocks = []; + + for (const clientId of action.clientIds) { + if (state.parents[clientId] !== undefined && (state.parents[clientId] === '' || newState.byClientId[state.parents[clientId]])) { + parentsOfRemovedBlocks.push(state.parents[clientId]); + } + } + + newState.tree = updateParentInnerBlocksInTree(newState, (0,external_lodash_namespaceObject.omit)(newState.tree, action.removedClientIds.concat(action.removedClientIds.map(clientId => 'controlled||' + clientId))), parentsOfRemovedBlocks, true); break; case 'MOVE_BLOCKS_TO_POSITION': { - const updatedBlockUids = [...action.clientIds]; + const updatedBlockUids = []; if (action.fromRootClientId) { updatedBlockUids.push(action.fromRootClientId); @@ -7901,35 +3709,36 @@ updatedBlockUids.push(action.toRootClientId); } - newState.cache = { ...newState.cache, - ...fillKeysWithEmptyObject(getBlocksWithParentsClientIds(updatedBlockUids)) - }; + if (!action.fromRootClientId || !action.fromRootClientId) { + updatedBlockUids.push(''); + } + + newState.tree = updateParentInnerBlocksInTree(newState, newState.tree, updatedBlockUids, true); break; } case 'MOVE_BLOCKS_UP': case 'MOVE_BLOCKS_DOWN': { - const updatedBlockUids = []; - - if (action.rootClientId) { - updatedBlockUids.push(action.rootClientId); - } - - newState.cache = { ...newState.cache, - ...fillKeysWithEmptyObject(getBlocksWithParentsClientIds(updatedBlockUids)) - }; + const updatedBlockUids = [action.rootClientId ? action.rootClientId : '']; + newState.tree = updateParentInnerBlocksInTree(newState, newState.tree, updatedBlockUids, true); break; } case 'SAVE_REUSABLE_BLOCK_SUCCESS': { - const updatedBlockUids = Object(external_lodash_["keys"])(Object(external_lodash_["omitBy"])(newState.attributes, (attributes, clientId) => { + const updatedBlockUids = (0,external_lodash_namespaceObject.keys)((0,external_lodash_namespaceObject.omitBy)(newState.attributes, (attributes, clientId) => { return newState.byClientId[clientId].name !== 'core/block' || attributes.ref !== action.updatedId; })); - newState.cache = { ...newState.cache, - ...fillKeysWithEmptyObject(getBlocksWithParentsClientIds(updatedBlockUids)) - }; + newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree, + ...updatedBlockUids.reduce((result, clientId) => { + result[clientId] = { ...newState.byClientId[clientId], + attributes: newState.attributes[clientId], + innerBlocks: newState.tree[clientId].innerBlocks + }; + return result; + }, {}) + }, updatedBlockUids, false); } } @@ -8073,54 +3882,22 @@ const withBlockReset = reducer => (state, action) => { - if (state && action.type === 'RESET_BLOCKS') { - /** - * A list of client IDs associated with the top level entity (like a - * post or template). It excludes the client IDs of blocks associated - * with other entities, like inner block controllers or reusable blocks. - */ - const visibleClientIds = getNestedBlockClientIds(state.order, '', state.controlledInnerBlocks); // pickBy returns only the truthy values from controlledInnerBlocks - - const controlledInnerBlocks = Object.keys(Object(external_lodash_["pickBy"])(state.controlledInnerBlocks)); - /** - * Each update operation consists of a few parts: - * 1. First, the client IDs associated with the top level entity are - * removed from the existing state key, leaving in place controlled - * blocks (like reusable blocks and inner block controllers). - * 2. Second, the blocks from the reset action are used to calculate the - * individual state keys. This will re-populate the clientIDs which - * were removed in step 1. - * 3. In some cases, we remove the recalculated inner block controllers, - * letting their old values persist. We need to do this because the - * reset block action from a top-level entity is not aware of any - * inner blocks inside InnerBlock controllers. So if the new values - * were used, it would not take into account the existing InnerBlocks - * which already exist in the state for inner block controllers. For - * example, `attributes` uses the newly computed value for controllers - * since attributes are stored in the top-level entity. But `order` - * uses the previous value for the controllers since the new value - * does not include the order of controlled inner blocks. So if the - * new value was used, template parts would disappear from the editor - * whenever you try to undo a change in the top level entity. - */ - - return { ...state, - byClientId: { ...Object(external_lodash_["omit"])(state.byClientId, visibleClientIds), - ...getFlattenedBlocksWithoutAttributes(action.blocks) - }, - attributes: { ...Object(external_lodash_["omit"])(state.attributes, visibleClientIds), - ...getFlattenedBlockAttributes(action.blocks) - }, - order: { ...Object(external_lodash_["omit"])(state.order, visibleClientIds), - ...Object(external_lodash_["omit"])(mapBlockOrder(action.blocks), controlledInnerBlocks) - }, - parents: { ...Object(external_lodash_["omit"])(state.parents, visibleClientIds), - ...mapBlockParents(action.blocks) - }, - cache: { ...Object(external_lodash_["omit"])(state.cache, visibleClientIds), - ...Object(external_lodash_["omit"])(Object(external_lodash_["mapValues"])(flattenBlocks(action.blocks), () => ({})), controlledInnerBlocks) - } - }; + if (action.type === 'RESET_BLOCKS') { + const newState = { ...state, + byClientId: getFlattenedBlocksWithoutAttributes(action.blocks), + attributes: getFlattenedBlockAttributes(action.blocks), + order: mapBlockOrder(action.blocks), + parents: mapBlockParents(action.blocks), + controlledInnerBlocks: {} + }; + const subTree = buildBlockTree(newState, action.blocks); + newState.tree = { ...subTree, + // Root. + '': { + innerBlocks: action.blocks.map(subBlock => subTree[subBlock.clientId]) + } + }; + return newState; } return reducer(state, action); @@ -8191,7 +3968,7 @@ // from its entity.. stateAfterInsert.order = { ...stateAfterInsert.order, - ...Object(external_lodash_["reduce"])(nestedControllers, (result, value, key) => { + ...(0,external_lodash_namespaceObject.reduce)(nestedControllers, (result, value, key) => { if (state.order[key]) { result[key] = state.order[key]; } @@ -8220,7 +3997,7 @@ const { id, updatedId - } = action; // If a temporary reusable block is saved, we swap the temporary id with the final one + } = action; // If a temporary reusable block is saved, we swap the temporary id with the final one. if (id === updatedId) { return state; @@ -8228,7 +4005,7 @@ state = { ...state }; - state.attributes = Object(external_lodash_["mapValues"])(state.attributes, (attributes, clientId) => { + state.attributes = (0,external_lodash_namespaceObject.mapValues)(state.attributes, (attributes, clientId) => { const { name } = state.byClientId[clientId]; @@ -8246,6 +4023,29 @@ return reducer(state, action); }; /** + * Higher-order reducer which removes blocks from state when switching parent block controlled state. + * + * @param {Function} reducer Original reducer function. + * + * @return {Function} Enhanced reducer function. + */ + + +const withResetControlledBlocks = reducer => (state, action) => { + if (action.type === 'SET_HAS_CONTROLLED_INNER_BLOCKS') { + // when switching a block from controlled to uncontrolled or inverse, + // we need to remove its content first. + const tempState = reducer(state, { + type: 'REPLACE_INNER_BLOCKS', + rootClientId: action.clientId, + blocks: [] + }); + return reducer(tempState, action); + } + + return reducer(state, action); +}; +/** * Reducer returning the blocks state. * * @param {Object} state Current state. @@ -8255,15 +4055,15 @@ */ -const reducer_blocks = Object(external_lodash_["flow"])(external_wp_data_["combineReducers"], withSaveReusableBlock, // needs to be before withBlockCache -withBlockCache, // needs to be before withInnerBlocksRemoveCascade -withInnerBlocksRemoveCascade, withReplaceInnerBlocks, // needs to be after withInnerBlocksRemoveCascade -withBlockReset, withPersistentBlockChange, withIgnoredBlockChange)({ - byClientId(state = {}, action) { +const blocks = (0,external_lodash_namespaceObject.flow)(external_wp_data_namespaceObject.combineReducers, withSaveReusableBlock, // Needs to be before withBlockCache. +withBlockTree, // Needs to be before withInnerBlocksRemoveCascade. +withInnerBlocksRemoveCascade, withReplaceInnerBlocks, // Needs to be after withInnerBlocksRemoveCascade. +withBlockReset, withPersistentBlockChange, withIgnoredBlockChange, withResetControlledBlocks)({ + byClientId() { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let action = arguments.length > 1 ? arguments[1] : undefined; + switch (action.type) { - case 'RESET_BLOCKS': - return getFlattenedBlocksWithoutAttributes(action.blocks); - case 'RECEIVE_BLOCKS': case 'INSERT_BLOCKS': return { ...state, @@ -8271,15 +4071,15 @@ }; case 'UPDATE_BLOCK': - // Ignore updates if block isn't known + // Ignore updates if block isn't known. if (!state[action.clientId]) { return state; } // Do nothing if only attributes change. - const changes = Object(external_lodash_["omit"])(action.updates, 'attributes'); - - if (Object(external_lodash_["isEmpty"])(changes)) { + const changes = (0,external_lodash_namespaceObject.omit)(action.updates, 'attributes'); + + if ((0,external_lodash_namespaceObject.isEmpty)(changes)) { return state; } @@ -8294,22 +4094,22 @@ return state; } - return { ...Object(external_lodash_["omit"])(state, action.replacedClientIds), + return { ...(0,external_lodash_namespaceObject.omit)(state, action.replacedClientIds), ...getFlattenedBlocksWithoutAttributes(action.blocks) }; case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN': - return Object(external_lodash_["omit"])(state, action.removedClientIds); + return (0,external_lodash_namespaceObject.omit)(state, action.removedClientIds); } return state; }, - attributes(state = {}, action) { + attributes() { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let action = arguments.length > 1 ? arguments[1] : undefined; + switch (action.type) { - case 'RESET_BLOCKS': - return getFlattenedBlockAttributes(action.blocks); - case 'RECEIVE_BLOCKS': case 'INSERT_BLOCKS': return { ...state, @@ -8336,7 +4136,7 @@ } const next = action.clientIds.reduce((accumulator, id) => ({ ...accumulator, - [id]: Object(external_lodash_["reduce"])(action.uniqueByBlock ? action.attributes[id] : action.attributes, (result, value, key) => { + [id]: (0,external_lodash_namespaceObject.reduce)(action.uniqueByBlock ? action.attributes[id] : action.attributes, (result, value, key) => { // Consider as updates only changed values. if (value !== result[key]) { result = getMutateSafeObject(state[id], result); @@ -8361,26 +4161,30 @@ return state; } - return { ...Object(external_lodash_["omit"])(state, action.replacedClientIds), + return { ...(0,external_lodash_namespaceObject.omit)(state, action.replacedClientIds), ...getFlattenedBlockAttributes(action.blocks) }; case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN': - return Object(external_lodash_["omit"])(state, action.removedClientIds); + return (0,external_lodash_namespaceObject.omit)(state, action.removedClientIds); } return state; }, - order(state = {}, action) { + order() { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let action = arguments.length > 1 ? arguments[1] : undefined; + switch (action.type) { - case 'RESET_BLOCKS': - return mapBlockOrder(action.blocks); - case 'RECEIVE_BLOCKS': - return { ...state, - ...Object(external_lodash_["omit"])(mapBlockOrder(action.blocks), '') - }; + { + const blockOrder = mapBlockOrder(action.blocks); + return { ...state, + ...(0,external_lodash_namespaceObject.omit)(blockOrder, ''), + '': ((state === null || state === void 0 ? void 0 : state['']) || []).concat(blockOrder['']) + }; + } case 'INSERT_BLOCKS': { @@ -8407,7 +4211,7 @@ } = action; const { index = state[toRootClientId].length - } = action; // Moving inside the same parent block + } = action; // Moving inside the same parent block. if (fromRootClientId === toRootClientId) { const subState = state[toRootClientId]; @@ -8415,11 +4219,11 @@ return { ...state, [toRootClientId]: moveTo(state[toRootClientId], fromIndex, index, clientIds.length) }; - } // Moving from a parent block to another + } // Moving from a parent block to another. return { ...state, - [fromRootClientId]: Object(external_lodash_["without"])(state[fromRootClientId], ...clientIds), + [fromRootClientId]: (0,external_lodash_namespaceObject.without)(state[fromRootClientId], ...clientIds), [toRootClientId]: insertAt(state[toRootClientId], clientIds, index) }; } @@ -8430,10 +4234,10 @@ clientIds, rootClientId = '' } = action; - const firstClientId = Object(external_lodash_["first"])(clientIds); + const firstClientId = (0,external_lodash_namespaceObject.first)(clientIds); const subState = state[rootClientId]; - if (!subState.length || firstClientId === Object(external_lodash_["first"])(subState)) { + if (!subState.length || firstClientId === (0,external_lodash_namespaceObject.first)(subState)) { return state; } @@ -8449,11 +4253,11 @@ clientIds, rootClientId = '' } = action; - const firstClientId = Object(external_lodash_["first"])(clientIds); - const lastClientId = Object(external_lodash_["last"])(clientIds); + const firstClientId = (0,external_lodash_namespaceObject.first)(clientIds); + const lastClientId = (0,external_lodash_namespaceObject.last)(clientIds); const subState = state[rootClientId]; - if (!subState.length || lastClientId === Object(external_lodash_["last"])(subState)) { + if (!subState.length || lastClientId === (0,external_lodash_namespaceObject.last)(subState)) { return state; } @@ -8474,9 +4278,9 @@ } const mappedBlocks = mapBlockOrder(action.blocks); - return Object(external_lodash_["flow"])([nextState => Object(external_lodash_["omit"])(nextState, action.replacedClientIds), nextState => ({ ...nextState, - ...Object(external_lodash_["omit"])(mappedBlocks, '') - }), nextState => Object(external_lodash_["mapValues"])(nextState, subState => Object(external_lodash_["reduce"])(subState, (result, clientId) => { + return (0,external_lodash_namespaceObject.flow)([nextState => (0,external_lodash_namespaceObject.omit)(nextState, action.replacedClientIds), nextState => ({ ...nextState, + ...(0,external_lodash_namespaceObject.omit)(mappedBlocks, '') + }), nextState => (0,external_lodash_namespaceObject.mapValues)(nextState, subState => (0,external_lodash_namespaceObject.reduce)(subState, (result, clientId) => { if (clientId === clientIds[0]) { return [...result, ...mappedBlocks['']]; } @@ -8490,9 +4294,9 @@ } case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN': - return Object(external_lodash_["flow"])([// Remove inner block ordering for removed blocks - nextState => Object(external_lodash_["omit"])(nextState, action.removedClientIds), // Remove deleted blocks from other blocks' orderings - nextState => Object(external_lodash_["mapValues"])(nextState, subState => Object(external_lodash_["without"])(subState, ...action.removedClientIds))])(state); + return (0,external_lodash_namespaceObject.flow)([// Remove inner block ordering for removed blocks. + nextState => (0,external_lodash_namespaceObject.omit)(nextState, action.removedClientIds), // Remove deleted blocks from other blocks' orderings. + nextState => (0,external_lodash_namespaceObject.mapValues)(nextState, subState => (0,external_lodash_namespaceObject.without)(subState, ...action.removedClientIds))])(state); } return state; @@ -8500,11 +4304,11 @@ // While technically redundant data as the inverse of `order`, it serves as // an optimization for the selectors which derive the ancestry of a block. - parents(state = {}, action) { + parents() { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let action = arguments.length > 1 ? arguments[1] : undefined; + switch (action.type) { - case 'RESET_BLOCKS': - return mapBlockParents(action.blocks); - case 'RECEIVE_BLOCKS': return { ...state, ...mapBlockParents(action.blocks) @@ -8526,22 +4330,25 @@ } case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN': - return { ...Object(external_lodash_["omit"])(state, action.replacedClientIds), + return { ...(0,external_lodash_namespaceObject.omit)(state, action.replacedClientIds), ...mapBlockParents(action.blocks, state[action.clientIds[0]]) }; case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN': - return Object(external_lodash_["omit"])(state, action.removedClientIds); + return (0,external_lodash_namespaceObject.omit)(state, action.removedClientIds); } return state; }, - controlledInnerBlocks(state = {}, { - type, - clientId, - hasControlledInnerBlocks - }) { + controlledInnerBlocks() { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let { + type, + clientId, + hasControlledInnerBlocks + } = arguments.length > 1 ? arguments[1] : undefined; + if (type === 'SET_HAS_CONTROLLED_INNER_BLOCKS') { return { ...state, [clientId]: hasControlledInnerBlocks @@ -8561,7 +4368,10 @@ * @return {boolean} Updated state. */ -function reducer_isTyping(state = false, action) { +function isTyping() { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + let action = arguments.length > 1 ? arguments[1] : undefined; + switch (action.type) { case 'START_TYPING': return true; @@ -8576,12 +4386,15 @@ * Reducer returning dragged block client id. * * @param {string[]} state Current state. - * @param {Object} action Dispatched action. + * @param {Object} action Dispatched action. * * @return {string[]} Updated state. */ -function draggedBlocks(state = [], action) { +function draggedBlocks() { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + let action = arguments.length > 1 ? arguments[1] : undefined; + switch (action.type) { case 'START_DRAGGING_BLOCKS': return action.clientIds; @@ -8601,7 +4414,10 @@ * @return {boolean} Updated state. */ -function reducer_isCaretWithinFormattedText(state = false, action) { +function isCaretWithinFormattedText() { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + let action = arguments.length > 1 ? arguments[1] : undefined; + switch (action.type) { case 'ENTER_FORMATTED_TEXT': return true; @@ -8622,7 +4438,10 @@ * @return {Object} Updated state. */ -function selectionHelper(state = {}, action) { +function selectionHelper() { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let action = arguments.length > 1 ? arguments[1] : undefined; + switch (action.type) { case 'CLEAR_SELECTED_BLOCK': { @@ -8667,8 +4486,7 @@ return state; } - const indexToSelect = action.indexToSelect || action.blocks.length - 1; - const blockToSelect = action.blocks[indexToSelect]; + const blockToSelect = action.blocks[action.indexToSelect] || action.blocks[action.blocks.length - 1]; if (!blockToSelect) { return {}; @@ -8696,22 +4514,32 @@ */ -function reducer_selection(state = {}, action) { - var _state$selectionStart, _state$selectionEnd; +function selection() { + var _state$selectionStart, _state$selectionEnd, _state$selectionStart2, _state$selectionEnd2; + + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let action = arguments.length > 1 ? arguments[1] : undefined; switch (action.type) { case 'SELECTION_CHANGE': + if (action.clientId) { + return { + selectionStart: { + clientId: action.clientId, + attributeKey: action.attributeKey, + offset: action.startOffset + }, + selectionEnd: { + clientId: action.clientId, + attributeKey: action.attributeKey, + offset: action.endOffset + } + }; + } + return { - selectionStart: { - clientId: action.clientId, - attributeKey: action.attributeKey, - offset: action.startOffset - }, - selectionEnd: { - clientId: action.clientId, - attributeKey: action.attributeKey, - offset: action.endOffset - } + selectionStart: action.start || state.selectionStart, + selectionEnd: action.end || state.selectionEnd }; case 'RESET_SELECTION': @@ -8729,6 +4557,11 @@ start, end } = action; + + if (start === ((_state$selectionStart = state.selectionStart) === null || _state$selectionStart === void 0 ? void 0 : _state$selectionStart.clientId) && end === ((_state$selectionEnd = state.selectionEnd) === null || _state$selectionEnd === void 0 ? void 0 : _state$selectionEnd.clientId)) { + return state; + } + return { selectionStart: { clientId: start @@ -8739,8 +4572,8 @@ }; case 'RESET_BLOCKS': - const startClientId = state === null || state === void 0 ? void 0 : (_state$selectionStart = state.selectionStart) === null || _state$selectionStart === void 0 ? void 0 : _state$selectionStart.clientId; - const endClientId = state === null || state === void 0 ? void 0 : (_state$selectionEnd = state.selectionEnd) === null || _state$selectionEnd === void 0 ? void 0 : _state$selectionEnd.clientId; // Do nothing if there's no selected block. + const startClientId = state === null || state === void 0 ? void 0 : (_state$selectionStart2 = state.selectionStart) === null || _state$selectionStart2 === void 0 ? void 0 : _state$selectionStart2.clientId; + const endClientId = state === null || state === void 0 ? void 0 : (_state$selectionEnd2 = state.selectionEnd) === null || _state$selectionEnd2 === void 0 ? void 0 : _state$selectionEnd2.clientId; // Do nothing if there's no selected block. if (!startClientId && !endClientId) { return state; @@ -8777,7 +4610,10 @@ * @return {boolean} Updated state. */ -function reducer_isMultiSelecting(state = false, action) { +function isMultiSelecting() { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + let action = arguments.length > 1 ? arguments[1] : undefined; + switch (action.type) { case 'START_MULTI_SELECT': return true; @@ -8797,7 +4633,10 @@ * @return {boolean} Updated state. */ -function reducer_isSelectionEnabled(state = true, action) { +function isSelectionEnabled() { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + let action = arguments.length > 1 ? arguments[1] : undefined; + switch (action.type) { case 'TOGGLE_SELECTION': return action.isSelectionEnabled; @@ -8806,7 +4645,7 @@ return state; } /** - * Reducer returning the intial block selection. + * Reducer returning the initial block selection. * * Currently this in only used to restore the selection after block deletion and * pasting new content.This reducer should eventually be removed in favour of setting @@ -8818,16 +4657,22 @@ * @return {number|null} Initial position: 0, -1 or null. */ -function reducer_initialPosition(state = null, action) { +function initialPosition() { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + let action = arguments.length > 1 ? arguments[1] : undefined; + if (action.type === 'REPLACE_BLOCKS' && action.initialPosition !== undefined) { return action.initialPosition; - } else if (['SELECT_BLOCK', 'RESET_SELECTION', 'INSERT_BLOCKS', 'REPLACE_INNER_BLOCKS'].includes(action.type)) { + } else if (['MULTI_SELECT', 'SELECT_BLOCK', 'RESET_SELECTION', 'INSERT_BLOCKS', 'REPLACE_INNER_BLOCKS'].includes(action.type)) { return action.initialPosition; } return state; } -function blocksMode(state = {}, action) { +function blocksMode() { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let action = arguments.length > 1 ? arguments[1] : undefined; + if (action.type === 'TOGGLE_BLOCK_MODE') { const { clientId @@ -8850,7 +4695,10 @@ * @return {Object} Updated state. */ -function reducer_insertionPoint(state = null, action) { +function insertionPoint() { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + let action = arguments.length > 1 ? arguments[1] : undefined; + switch (action.type) { case 'SHOW_INSERTION_POINT': const { @@ -8879,9 +4727,12 @@ * @return {boolean} Updated state. */ -function reducer_template(state = { - isValid: true -}, action) { +function template() { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { + isValid: true + }; + let action = arguments.length > 1 ? arguments[1] : undefined; + switch (action.type) { case 'SET_TEMPLATE_VALIDITY': return { ...state, @@ -8900,7 +4751,10 @@ * @return {Object} Updated state. */ -function reducer_settings(state = SETTINGS_DEFAULTS, action) { +function settings() { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : SETTINGS_DEFAULTS; + let action = arguments.length > 1 ? arguments[1] : undefined; + switch (action.type) { case 'UPDATE_SETTINGS': return { ...state, @@ -8913,13 +4767,16 @@ /** * Reducer returning the user preferences. * - * @param {Object} state Current state. - * @param {Object} action Dispatched action. + * @param {Object} state Current state. + * @param {Object} action Dispatched action. * * @return {string} Updated state. */ -function preferences(state = PREFERENCES_DEFAULTS, action) { +function preferences() { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : PREFERENCES_DEFAULTS; + let action = arguments.length > 1 ? arguments[1] : undefined; + switch (action.type) { case 'INSERT_BLOCKS': case 'REPLACE_BLOCKS': @@ -8928,7 +4785,7 @@ attributes, name: blockName } = block; - const match = Object(external_wp_data_["select"])(external_wp_blocks_["store"]).getActiveBlockVariation(blockName, attributes); // If a block variation match is found change the name to be the same with the + const match = (0,external_wp_data_namespaceObject.select)(external_wp_blocks_namespaceObject.store).getActiveBlockVariation(blockName, attributes); // If a block variation match is found change the name to be the same with the // one that is used for block variations in the Inserter (`getItemFromVariation`). let id = match !== null && match !== void 0 && match.name ? `${blockName}/${match.name}` : blockName; @@ -8965,14 +4822,17 @@ * @return {Object} Updated state. */ -const reducer_blockListSettings = (state = {}, action) => { +const blockListSettings = function () { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let 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); + return (0,external_lodash_namespaceObject.omit)(state, action.clientIds); } case 'UPDATE_BLOCK_LIST_SETTINGS': @@ -8983,13 +4843,13 @@ if (!action.settings) { if (state.hasOwnProperty(clientId)) { - return Object(external_lodash_["omit"])(state, clientId); + return (0,external_lodash_namespaceObject.omit)(state, clientId); } return state; } - if (Object(external_lodash_["isEqual"])(state[clientId], action.settings)) { + if ((0,external_lodash_namespaceObject.isEqual)(state[clientId], action.settings)) { return state; } @@ -9010,7 +4870,10 @@ * @return {string} Updated state. */ -function reducer_isNavigationMode(state = false, action) { +function isNavigationMode() { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + let action = arguments.length > 1 ? arguments[1] : undefined; + // Let inserting block always trigger Edit mode. if (action.type === 'INSERT_BLOCKS') { return false; @@ -9026,12 +4889,15 @@ * Reducer returning whether the block moving mode is enabled or not. * * @param {string|null} state Current state. - * @param {Object} action Dispatched action. + * @param {Object} action Dispatched action. * * @return {string|null} Updated state. */ -function reducer_hasBlockMovingClientId(state = null, action) { +function hasBlockMovingClientId() { + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + let action = arguments.length > 1 ? arguments[1] : undefined; + // Let inserting block always trigger Edit mode. if (action.type === 'SET_BLOCK_MOVING_MODE') { return action.hasBlockMovingClientId; @@ -9149,15 +5015,18 @@ /** * Reducer returning the block insertion event list state. * - * @param {Object} state Current state. - * @param {Object} action Dispatched action. + * @param {Object} state Current state. + * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ -function lastBlockInserted(state = {}, action) { +function lastBlockInserted() { var _action$meta; + let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let action = arguments.length > 1 ? arguments[1] : undefined; + switch (action.type) { case 'INSERT_BLOCKS': if (!action.blocks.length) { @@ -9177,45 +5046,364 @@ return state; } -/* harmony default export */ var store_reducer = (Object(external_wp_data_["combineReducers"])({ - blocks: reducer_blocks, - isTyping: reducer_isTyping, +/* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ + blocks, + isTyping, draggedBlocks, - isCaretWithinFormattedText: reducer_isCaretWithinFormattedText, - selection: reducer_selection, - isMultiSelecting: reducer_isMultiSelecting, - isSelectionEnabled: reducer_isSelectionEnabled, - initialPosition: reducer_initialPosition, + isCaretWithinFormattedText, + selection, + isMultiSelecting, + isSelectionEnabled, + initialPosition, blocksMode, - blockListSettings: reducer_blockListSettings, - insertionPoint: reducer_insertionPoint, - template: reducer_template, - settings: reducer_settings, + blockListSettings, + insertionPoint, + template, + settings, preferences, lastBlockAttributesChange, - isNavigationMode: reducer_isNavigationMode, - hasBlockMovingClientId: reducer_hasBlockMovingClientId, + isNavigationMode, + hasBlockMovingClientId, automaticChangeStatus, highlightedBlock, lastBlockInserted })); -// EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js -var rememo = __webpack_require__("pPDe"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/selectors.js - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - +;// CONCATENATED MODULE: ./node_modules/rememo/es/rememo.js + + +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 */ function rememo(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; +} + +;// CONCATENATED MODULE: external ["wp","primitives"] +var external_wp_primitives_namespaceObject = window["wp"]["primitives"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol.js + + +/** + * WordPress dependencies + */ + +const symbol = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" +})); +/* harmony default export */ var library_symbol = (symbol); + +;// CONCATENATED MODULE: external ["wp","richText"] +var external_wp_richText_namespaceObject = window["wp"]["richText"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/utils.js +/** + * Helper function that maps attribute definition properties to the + * ones used by RichText utils like `create, toHTMLString, etc..`. + * + * @param {Object} attributeDefinition A block's attribute definition object. + * @return {Object} The mapped object. + */ +function mapRichTextSettings(attributeDefinition) { + const { + multiline: multilineTag, + __unstableMultilineWrapperTags: multilineWrapperTags, + __unstablePreserveWhiteSpace: preserveWhiteSpace + } = attributeDefinition; + return { + multilineTag, + multilineWrapperTags, + preserveWhiteSpace + }; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/selectors.js +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + + + +/** + * Internal dependencies + */ /** @@ -9228,22 +5416,11 @@ * @property {number} offset An attribute value offset, based on the rich * text value. See `wp.richText.create`. */ -// Module constants +// Module constants. const MILLISECONDS_PER_HOUR = 3600 * 1000; const MILLISECONDS_PER_DAY = 24 * 3600 * 1000; const MILLISECONDS_PER_WEEK = 7 * 24 * 3600 * 1000; -const templateIcon = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_components_["Rect"], { - x: "0", - fill: "none", - width: "24", - height: "24" -}), Object(external_wp_element_["createElement"])(external_wp_components_["G"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { - d: "M19 3H5c-1.105 0-2 .895-2 2v14c0 1.105.895 2 2 2h14c1.105 0 2-.895 2-2V5c0-1.105-.895-2-2-2zM6 6h5v5H6V6zm4.5 13C9.12 19 8 17.88 8 16.5S9.12 14 10.5 14s2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5zm3-6l3-5 3 5h-6z" -}))); /** * 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 @@ -9265,11 +5442,11 @@ * @return {string} Block name. */ -function selectors_getBlockName(state, clientId) { +function getBlockName(state, clientId) { const block = state.blocks.byClientId[clientId]; const socialLinkName = 'core/social-link'; - if (external_wp_element_["Platform"].OS !== 'web' && (block === null || block === void 0 ? void 0 : block.name) === socialLinkName) { + if (external_wp_element_namespaceObject.Platform.OS !== 'web' && (block === null || block === void 0 ? void 0 : block.name) === socialLinkName) { const attributes = state.blocks.attributes[clientId]; const { service @@ -9288,7 +5465,7 @@ * @return {boolean} Is Valid. */ -function selectors_isBlockValid(state, clientId) { +function isBlockValid(state, clientId) { const block = state.blocks.byClientId[clientId]; return !!block && block.isValid; } @@ -9302,7 +5479,7 @@ * @return {Object?} Block attributes. */ -function selectors_getBlockAttributes(state, clientId) { +function getBlockAttributes(state, clientId) { const block = state.blocks.byClientId[clientId]; if (!block) { @@ -9333,24 +5510,16 @@ * @return {Object} Parsed block object. */ -const selectors_getBlock = Object(rememo["a" /* default */])((state, clientId) => { +function getBlock(state, clientId) { const block = state.blocks.byClientId[clientId]; if (!block) { return null; } - return { ...block, - attributes: selectors_getBlockAttributes(state, clientId), - innerBlocks: areInnerBlocksControlled(state, clientId) ? EMPTY_ARRAY : selectors_getBlocks(state, clientId) - }; -}, (state, clientId) => [// Normally, we'd have both `getBlockAttributes` dependencies and -// `getBlocks` (children) dependencies here but for performance reasons -// we use a denormalized cache key computed in the reducer that takes both -// the attributes and inner blocks into account. The value of the cache key -// is being changed whenever one of these dependencies is out of date. -state.blocks.cache[clientId]]); -const selectors_unstableGetBlockWithoutInnerBlocks = Object(rememo["a" /* default */])((state, clientId) => { + return state.blocks.tree[clientId]; +} +const __unstableGetBlockWithoutInnerBlocks = rememo((state, clientId) => { const block = state.blocks.byClientId[clientId]; if (!block) { @@ -9358,7 +5527,7 @@ } return { ...block, - attributes: selectors_getBlockAttributes(state, clientId) + attributes: getBlockAttributes(state, clientId) }; }, (state, clientId) => [state.blocks.byClientId[clientId], state.blocks.attributes[clientId]]); /** @@ -9366,56 +5535,18 @@ * the order they appear in the post. Note that this will exclude child blocks * of nested inner block controllers. * - * Note: It's important to memoize this selector to avoid return a new instance - * on each call. We use the block cache state for each top-level block of the - * given clientID. This way, the selector only refreshes on changes to blocks - * associated with the given entity, and does not refresh when changes are made - * to blocks which are part of different inner block controllers. - * * @param {Object} state Editor state. * @param {?string} rootClientId Optional root client ID of block list. * * @return {Object[]} Post blocks. */ -const selectors_getBlocks = Object(rememo["a" /* default */])((state, rootClientId) => { - return Object(external_lodash_["map"])(selectors_getBlockOrder(state, rootClientId), clientId => selectors_getBlock(state, clientId)); -}, (state, rootClientId) => Object(external_lodash_["map"])(state.blocks.order[rootClientId || ''], id => state.blocks.cache[id])); -/** - * Similar to getBlock, except it will include the entire nested block tree as - * inner blocks. The normal getBlock selector will exclude sections of the block - * tree which belong to different entities. - * - * @param {Object} state Editor state. - * @param {string} clientId Client ID of the block to get. - * - * @return {Object} The block with all - */ - -const __unstableGetBlockWithBlockTree = Object(rememo["a" /* default */])((state, clientId) => { - const block = state.blocks.byClientId[clientId]; - - if (!block) { - return null; - } - - return { ...block, - attributes: selectors_getBlockAttributes(state, clientId), - innerBlocks: __unstableGetBlockTree(state, clientId) - }; -}, state => [state.blocks.byClientId, state.blocks.order, state.blocks.attributes]); -/** - * Similar to getBlocks, except this selector returns the entire block tree - * represented in the block-editor store from the given root regardless of any - * inner block controllers. - * - * @param {Object} state Editor state. - * @param {?string} rootClientId Optional root client ID of block list. - * - * @return {Object[]} Post blocks. - */ - -const __unstableGetBlockTree = Object(rememo["a" /* default */])((state, rootClientId = '') => Object(external_lodash_["map"])(selectors_getBlockOrder(state, rootClientId), clientId => __unstableGetBlockWithBlockTree(state, clientId)), state => [state.blocks.byClientId, state.blocks.order, state.blocks.attributes]); +function getBlocks(state, rootClientId) { + var _state$blocks$tree$tr; + + const treeKey = !rootClientId || !areInnerBlocksControlled(state, rootClientId) ? rootClientId || '' : 'controlled||' + rootClientId; + return ((_state$blocks$tree$tr = state.blocks.tree[treeKey]) === null || _state$blocks$tree$tr === void 0 ? void 0 : _state$blocks$tree$tr.innerBlocks) || EMPTY_ARRAY; +} /** * Returns a stripped down block object containing only its client ID, * and its inner blocks' client IDs. @@ -9426,9 +5557,9 @@ * @return {Object} Client IDs of the post blocks. */ -const selectors_unstableGetClientIdWithClientIdsTree = Object(rememo["a" /* default */])((state, clientId) => ({ +const __unstableGetClientIdWithClientIdsTree = rememo((state, clientId) => ({ clientId, - innerBlocks: selectors_unstableGetClientIdsTree(state, clientId) + innerBlocks: __unstableGetClientIdsTree(state, clientId) }), state => [state.blocks.order]); /** * Returns the block tree represented in the block-editor store from the @@ -9441,33 +5572,50 @@ * @return {Object[]} Client IDs of the post blocks. */ -const selectors_unstableGetClientIdsTree = Object(rememo["a" /* default */])((state, rootClientId = '') => Object(external_lodash_["map"])(selectors_getBlockOrder(state, rootClientId), clientId => selectors_unstableGetClientIdWithClientIdsTree(state, clientId)), state => [state.blocks.order]); -/** - * 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. +const __unstableGetClientIdsTree = rememo(function (state) { + let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + return (0,external_lodash_namespaceObject.map)(getBlockOrder(state, rootClientId), clientId => __unstableGetClientIdWithClientIdsTree(state, clientId)); +}, state => [state.blocks.order]); +/** + * Returns an array containing the clientIds of all descendants of the blocks + * given. Returned ids are ordered first by the order of the ids given, then + * by the order that they appear in the editor. + * + * @param {Object} state Global application state. + * @param {Array} clientIds Array of blocks to inspect. * * @return {Array} ids of descendants. */ -const selectors_getClientIdsOfDescendants = (state, clientIds) => Object(external_lodash_["flatMap"])(clientIds, clientId => { - const descendants = selectors_getBlockOrder(state, clientId); - return [...descendants, ...selectors_getClientIdsOfDescendants(state, descendants)]; -}); -/** - * Returns an array containing the clientIds of the top-level blocks - * and their descendants of any depth (for nested blocks). +const getClientIdsOfDescendants = rememo((state, clientIds) => { + const collectedIds = []; + + for (const givenId of clientIds) { + for (const descendantId of getBlockOrder(state, givenId)) { + collectedIds.push(descendantId, ...getClientIdsOfDescendants(state, [descendantId])); + } + } + + return collectedIds; +}, state => [state.blocks.order]); +/** + * Returns an array containing the clientIds of the top-level blocks and + * their descendants of any depth (for nested blocks). Ids are returned + * in the same order that they appear in the editor. * * @param {Object} state Global application state. * * @return {Array} ids of top-level and descendant blocks. */ -const getClientIdsWithDescendants = Object(rememo["a" /* default */])(state => { - const topLevelIds = selectors_getBlockOrder(state); - return [...topLevelIds, ...selectors_getClientIdsOfDescendants(state, topLevelIds)]; +const getClientIdsWithDescendants = rememo(state => { + const collectedIds = []; + + for (const topLevelId of getBlockOrder(state)) { + collectedIds.push(topLevelId, ...getClientIdsOfDescendants(state, [topLevelId])); + } + + return collectedIds; }, state => [state.blocks.order]); /** * Returns the total number of blocks, or the total number of blocks with a specific name in a post. @@ -9479,19 +5627,40 @@ * @return {number} Number of blocks in the post, or number of blocks with name equal to blockName. */ -const selectors_getGlobalBlockCount = Object(rememo["a" /* default */])((state, blockName) => { +const getGlobalBlockCount = rememo((state, blockName) => { const clientIds = getClientIdsWithDescendants(state); if (!blockName) { return clientIds.length; } - return Object(external_lodash_["reduce"])(clientIds, (accumulator, clientId) => { + return (0,external_lodash_namespaceObject.reduce)(clientIds, (accumulator, clientId) => { const block = state.blocks.byClientId[clientId]; return block.name === blockName ? accumulator + 1 : accumulator; }, 0); }, state => [state.blocks.order, state.blocks.byClientId]); /** + * Returns all global blocks that match a blockName. Results include nested blocks. + * + * @param {Object} state Global application state. + * @param {?string} blockName Optional block name, if not specified, returns an empty array. + * + * @return {Array} Array of clientIds of blocks with name equal to blockName. + */ + +const __experimentalGetGlobalBlocksByName = rememo((state, blockName) => { + if (!blockName) { + return EMPTY_ARRAY; + } + + const clientIds = getClientIdsWithDescendants(state); + const foundBlocks = clientIds.filter(clientId => { + const block = state.blocks.byClientId[clientId]; + return block.name === blockName; + }); + return foundBlocks.length > 0 ? foundBlocks : EMPTY_ARRAY; +}, state => [state.blocks.order, state.blocks.byClientId]); +/** * Given an array of block client IDs, returns the corresponding array of block * objects. * @@ -9501,7 +5670,7 @@ * @return {WPBlock[]} Block objects. */ -const selectors_getBlocksByClientId = Object(rememo["a" /* default */])((state, clientIds) => Object(external_lodash_["map"])(Object(external_lodash_["castArray"])(clientIds), clientId => selectors_getBlock(state, clientId)), state => [state.blocks.byClientId, state.blocks.order, state.blocks.attributes]); +const getBlocksByClientId = rememo((state, clientIds) => (0,external_lodash_namespaceObject.map)((0,external_lodash_namespaceObject.castArray)(clientIds), clientId => getBlock(state, clientId)), (state, clientIds) => (0,external_lodash_namespaceObject.map)((0,external_lodash_namespaceObject.castArray)(clientIds), clientId => state.blocks.tree[clientId])); /** * Returns the number of blocks currently present in the post. * @@ -9511,8 +5680,8 @@ * @return {number} Number of blocks in the post. */ -function selectors_getBlockCount(state, rootClientId) { - return selectors_getBlockOrder(state, rootClientId).length; +function getBlockCount(state, rootClientId) { + return getBlockOrder(state, rootClientId).length; } /** * Returns the current selection start block client ID, attribute key and text @@ -9523,7 +5692,7 @@ * @return {WPBlockSelection} Selection start information. */ -function selectors_getSelectionStart(state) { +function getSelectionStart(state) { return state.selection.selectionStart; } /** @@ -9535,7 +5704,7 @@ * @return {WPBlockSelection} Selection end information. */ -function selectors_getSelectionEnd(state) { +function getSelectionEnd(state) { return state.selection.selectionEnd; } /** @@ -9548,7 +5717,7 @@ * @return {?string} Client ID of block selection start. */ -function selectors_getBlockSelectionStart(state) { +function getBlockSelectionStart(state) { return state.selection.selectionStart.clientId; } /** @@ -9561,7 +5730,7 @@ * @return {?string} Client ID of block selection end. */ -function selectors_getBlockSelectionEnd(state) { +function getBlockSelectionEnd(state) { return state.selection.selectionEnd.clientId; } /** @@ -9572,8 +5741,8 @@ * @return {number} Number of blocks selected in the post. */ -function selectors_getSelectedBlockCount(state) { - const multiSelectedBlockCount = selectors_getMultiSelectedBlockClientIds(state).length; +function getSelectedBlockCount(state) { + const multiSelectedBlockCount = getMultiSelectedBlockClientIds(state).length; if (multiSelectedBlockCount) { return multiSelectedBlockCount; @@ -9589,7 +5758,7 @@ * @return {boolean} Whether a single block is selected. */ -function selectors_hasSelectedBlock(state) { +function hasSelectedBlock(state) { const { selectionStart, selectionEnd @@ -9605,7 +5774,7 @@ * @return {?string} Selected block client ID. */ -function selectors_getSelectedBlockClientId(state) { +function getSelectedBlockClientId(state) { const { selectionStart, selectionEnd @@ -9628,9 +5797,9 @@ * @return {?Object} Selected block. */ -function selectors_getSelectedBlock(state) { - const clientId = selectors_getSelectedBlockClientId(state); - return clientId ? selectors_getBlock(state, clientId) : null; +function getSelectedBlock(state) { + const clientId = getSelectedBlockClientId(state); + return clientId ? getBlock(state, clientId) : null; } /** * Given a block client ID, returns the root block from which the block is @@ -9643,20 +5812,21 @@ * @return {?string} Root client ID, if exists */ -function selectors_getBlockRootClientId(state, clientId) { +function getBlockRootClientId(state, clientId) { return state.blocks.parents[clientId] !== undefined ? state.blocks.parents[clientId] : null; } /** * Given a block client ID, returns the list of all its parents from top to bottom. * - * @param {Object} state Editor state. - * @param {string} clientId Block from which to find root client ID. + * @param {Object} state Editor state. + * @param {string} clientId Block from which to find root client ID. * @param {boolean} ascending Order results from bottom to top (true) or top to bottom (false). * * @return {Array} ClientIDs of the parent blocks. */ -const selectors_getBlockParents = Object(rememo["a" /* default */])((state, clientId, ascending = false) => { +const getBlockParents = rememo(function (state, clientId) { + let ascending = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; const parents = []; let current = clientId; @@ -9682,22 +5852,28 @@ * @return {Array} ClientIDs of the parent blocks. */ -const getBlockParentsByBlockName = Object(rememo["a" /* default */])((state, clientId, blockName, ascending = false) => { - const parents = selectors_getBlockParents(state, clientId, ascending); - return Object(external_lodash_["map"])(Object(external_lodash_["filter"])(Object(external_lodash_["map"])(parents, id => ({ +const getBlockParentsByBlockName = rememo(function (state, clientId, blockName) { + let ascending = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + const parents = getBlockParents(state, clientId, ascending); + return (0,external_lodash_namespaceObject.map)((0,external_lodash_namespaceObject.filter)((0,external_lodash_namespaceObject.map)(parents, id => ({ id, - name: selectors_getBlockName(state, id) - })), ({ - name - }) => { + name: getBlockName(state, id) + })), _ref => { + let { + name + } = _ref; + if (Array.isArray(blockName)) { return blockName.includes(name); } return name === blockName; - }), ({ - id - }) => id); + }), _ref2 => { + let { + id + } = _ref2; + return id; + }); }, state => [state.blocks.parents]); /** * 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. @@ -9708,7 +5884,7 @@ * @return {string} Root client ID */ -function selectors_getBlockHierarchyRootClientId(state, clientId) { +function getBlockHierarchyRootClientId(state, clientId) { let current = clientId; let parent; @@ -9729,9 +5905,9 @@ */ function getLowestCommonAncestorWithSelectedBlock(state, clientId) { - const selectedId = selectors_getSelectedBlockClientId(state); - const clientParents = [...selectors_getBlockParents(state, clientId), clientId]; - const selectedParents = [...selectors_getBlockParents(state, selectedId), selectedId]; + const selectedId = getSelectedBlockClientId(state); + const clientParents = [...getBlockParents(state, clientId), clientId]; + const selectedParents = [...getBlockParents(state, selectedId), selectedId]; let lowestCommonAncestor; const maxDepth = Math.min(clientParents.length, selectedParents.length); @@ -9760,18 +5936,20 @@ * @return {?string} Return the client ID of the block, or null if none exists. */ -function getAdjacentBlockClientId(state, startClientId, modifier = 1) { +function getAdjacentBlockClientId(state, startClientId) { + let modifier = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + // Default to selected block. if (startClientId === undefined) { - startClientId = selectors_getSelectedBlockClientId(state); + startClientId = getSelectedBlockClientId(state); } // Try multi-selection starting at extent based on modifier. if (startClientId === undefined) { if (modifier < 0) { - startClientId = selectors_getFirstMultiSelectedBlockClientId(state); - } else { - startClientId = selectors_getLastMultiSelectedBlockClientId(state); + startClientId = getFirstMultiSelectedBlockClientId(state); + } else { + startClientId = getLastMultiSelectedBlockClientId(state); } } // Validate working start client ID. @@ -9782,7 +5960,7 @@ // empty string top-level root by explicitly testing against null. - const rootClientId = selectors_getBlockRootClientId(state, startClientId); + const rootClientId = getBlockRootClientId(state, startClientId); if (rootClientId === null) { return null; @@ -9819,7 +5997,7 @@ * @return {?string} Adjacent block's client ID, or null if none exists. */ -function selectors_getPreviousBlockClientId(state, startClientId) { +function getPreviousBlockClientId(state, startClientId) { return getAdjacentBlockClientId(state, startClientId, -1); } /** @@ -9834,9 +6012,11 @@ * @return {?string} Adjacent block's client ID, or null if none exists. */ -function selectors_getNextBlockClientId(state, startClientId) { +function getNextBlockClientId(state, startClientId) { return getAdjacentBlockClientId(state, startClientId, 1); } +/* eslint-disable jsdoc/valid-types */ + /** * Returns the initial caret position for the selected block. * This position is to used to position the caret properly when the selected block changes. @@ -9847,7 +6027,8 @@ * @return {0|-1|null} Initial position. */ -function selectors_getSelectedBlocksInitialCaretPosition(state) { +function getSelectedBlocksInitialCaretPosition(state) { + /* eslint-enable jsdoc/valid-types */ return state.initialPosition; } /** @@ -9858,7 +6039,7 @@ * @return {Array} Multi-selected block client IDs. */ -const selectors_getSelectedBlockClientIds = Object(rememo["a" /* default */])(state => { +const getSelectedBlockClientIds = rememo(state => { const { selectionStart, selectionEnd @@ -9875,13 +6056,13 @@ // by explicitly testing against null. - const rootClientId = selectors_getBlockRootClientId(state, selectionStart.clientId); + const rootClientId = getBlockRootClientId(state, selectionStart.clientId); if (rootClientId === null) { return EMPTY_ARRAY; } - const blockOrder = selectors_getBlockOrder(state, rootClientId); + const blockOrder = getBlockOrder(state, rootClientId); const startIndex = blockOrder.indexOf(selectionStart.clientId); const endIndex = blockOrder.indexOf(selectionEnd.clientId); @@ -9900,7 +6081,7 @@ * @return {Array} Multi-selected block client IDs. */ -function selectors_getMultiSelectedBlockClientIds(state) { +function getMultiSelectedBlockClientIds(state) { const { selectionStart, selectionEnd @@ -9910,7 +6091,7 @@ return EMPTY_ARRAY; } - return selectors_getSelectedBlockClientIds(state); + return getSelectedBlockClientIds(state); } /** * Returns the current multi-selection set of blocks, or an empty array if @@ -9921,15 +6102,15 @@ * @return {Array} Multi-selected block objects. */ -const selectors_getMultiSelectedBlocks = Object(rememo["a" /* default */])(state => { - const multiSelectedBlockClientIds = selectors_getMultiSelectedBlockClientIds(state); +const getMultiSelectedBlocks = rememo(state => { + const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(state); if (!multiSelectedBlockClientIds.length) { return EMPTY_ARRAY; } - return multiSelectedBlockClientIds.map(clientId => selectors_getBlock(state, clientId)); -}, state => [...selectors_getSelectedBlockClientIds.getDependants(state), state.blocks.byClientId, state.blocks.order, state.blocks.attributes]); + return multiSelectedBlockClientIds.map(clientId => getBlock(state, clientId)); +}, state => [...getSelectedBlockClientIds.getDependants(state), state.blocks.byClientId, state.blocks.order, state.blocks.attributes]); /** * Returns the client ID of the first block in the multi-selection set, or null * if there is no multi-selection. @@ -9939,8 +6120,8 @@ * @return {?string} First block client ID in the multi-selection set. */ -function selectors_getFirstMultiSelectedBlockClientId(state) { - return Object(external_lodash_["first"])(selectors_getMultiSelectedBlockClientIds(state)) || null; +function getFirstMultiSelectedBlockClientId(state) { + return (0,external_lodash_namespaceObject.first)(getMultiSelectedBlockClientIds(state)) || null; } /** * Returns the client ID of the last block in the multi-selection set, or null @@ -9951,8 +6132,8 @@ * @return {?string} Last block client ID in the multi-selection set. */ -function selectors_getLastMultiSelectedBlockClientId(state) { - return Object(external_lodash_["last"])(selectors_getMultiSelectedBlockClientIds(state)) || null; +function getLastMultiSelectedBlockClientId(state) { + return (0,external_lodash_namespaceObject.last)(getMultiSelectedBlockClientIds(state)) || null; } /** * Returns true if a multi-selection exists, and the block corresponding to the @@ -9965,8 +6146,8 @@ * @return {boolean} Whether block is first in multi-selection. */ -function selectors_isFirstMultiSelectedBlock(state, clientId) { - return selectors_getFirstMultiSelectedBlockClientId(state) === clientId; +function isFirstMultiSelectedBlock(state, clientId) { + return getFirstMultiSelectedBlockClientId(state) === clientId; } /** * Returns true if the client ID occurs within the block multi-selection, or @@ -9978,8 +6159,8 @@ * @return {boolean} Whether block is in multi-selection set. */ -function selectors_isBlockMultiSelected(state, clientId) { - return selectors_getMultiSelectedBlockClientIds(state).indexOf(clientId) !== -1; +function isBlockMultiSelected(state, clientId) { + return getMultiSelectedBlockClientIds(state).indexOf(clientId) !== -1; } /** * Returns true if an ancestor of the block is multi-selected, or false @@ -9992,13 +6173,13 @@ * set. */ -const selectors_isAncestorMultiSelected = Object(rememo["a" /* default */])((state, clientId) => { +const isAncestorMultiSelected = rememo((state, clientId) => { let ancestorClientId = clientId; let isMultiSelected = false; while (ancestorClientId && !isMultiSelected) { - ancestorClientId = selectors_getBlockRootClientId(state, ancestorClientId); - isMultiSelected = selectors_isBlockMultiSelected(state, ancestorClientId); + ancestorClientId = getBlockRootClientId(state, ancestorClientId); + isMultiSelected = isBlockMultiSelected(state, ancestorClientId); } return isMultiSelected; @@ -10016,7 +6197,7 @@ * @return {?string} Client ID of block beginning multi-selection. */ -function selectors_getMultiSelectedBlocksStartClientId(state) { +function getMultiSelectedBlocksStartClientId(state) { const { selectionStart, selectionEnd @@ -10041,7 +6222,7 @@ * @return {?string} Client ID of block ending multi-selection. */ -function selectors_getMultiSelectedBlocksEndClientId(state) { +function getMultiSelectedBlocksEndClientId(state) { const { selectionStart, selectionEnd @@ -10054,6 +6235,152 @@ return selectionEnd.clientId || null; } /** + * Returns true if the selection is not partial. + * + * @param {Object} state Editor state. + * + * @return {boolean} Whether the selection is mergeable. + */ + +function __unstableIsFullySelected(state) { + const selectionAnchor = getSelectionStart(state); + const selectionFocus = getSelectionEnd(state); + return !selectionAnchor.attributeKey && !selectionFocus.attributeKey && typeof selectionAnchor.offset === 'undefined' && typeof selectionFocus.offset === 'undefined'; +} +/** + * Returns true if the selection is collapsed. + * + * @param {Object} state Editor state. + * + * @return {boolean} Whether the selection is collapsed. + */ + +function __unstableIsSelectionCollapsed(state) { + const selectionAnchor = getSelectionStart(state); + const selectionFocus = getSelectionEnd(state); + return !!selectionAnchor && !!selectionFocus && selectionAnchor.clientId === selectionFocus.clientId && selectionAnchor.attributeKey === selectionFocus.attributeKey && selectionAnchor.offset === selectionFocus.offset; +} +/** + * Check whether the selection is mergeable. + * + * @param {Object} state Editor state. + * @param {boolean} isForward Whether to merge forwards. + * + * @return {boolean} Whether the selection is mergeable. + */ + +function __unstableIsSelectionMergeable(state, isForward) { + const selectionAnchor = getSelectionStart(state); + const selectionFocus = getSelectionEnd(state); // It's not mergeable if the start and end are within the same block. + + if (selectionAnchor.clientId === selectionFocus.clientId) return false; // It's not mergeable if there's no rich text selection. + + if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') return false; + const anchorRootClientId = getBlockRootClientId(state, selectionAnchor.clientId); + const focusRootClientId = getBlockRootClientId(state, selectionFocus.clientId); // It's not mergeable if the selection doesn't start and end in the same + // block list. Maybe in the future it should be allowed. + + if (anchorRootClientId !== focusRootClientId) { + return false; + } + + const blockOrder = getBlockOrder(state, anchorRootClientId); + const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId); + const focusIndex = blockOrder.indexOf(selectionFocus.clientId); // Reassign selection start and end based on order. + + let selectionStart, selectionEnd; + + if (anchorIndex > focusIndex) { + selectionStart = selectionFocus; + selectionEnd = selectionAnchor; + } else { + selectionStart = selectionAnchor; + selectionEnd = selectionFocus; + } + + const targetBlockClientId = isForward ? selectionEnd.clientId : selectionStart.clientId; + const blockToMergeClientId = isForward ? selectionStart.clientId : selectionEnd.clientId; + const targetBlock = getBlock(state, targetBlockClientId); + const targetBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(targetBlock.name); + if (!targetBlockType.merge) return false; + const blockToMerge = getBlock(state, blockToMergeClientId); // It's mergeable if the blocks are of the same type. + + if (blockToMerge.name === targetBlock.name) return true; // If the blocks are of a different type, try to transform the block being + // merged into the same type of block. + + const blocksToMerge = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blockToMerge, targetBlock.name); + return blocksToMerge && blocksToMerge.length; +} +/** + * Get partial selected blocks with their content updated + * based on the selection. + * + * @param {Object} state Editor state. + * + * @return {Object[]} Updated partial selected blocks. + */ + +const __unstableGetSelectedBlocksWithPartialSelection = state => { + const selectionAnchor = getSelectionStart(state); + const selectionFocus = getSelectionEnd(state); + + if (selectionAnchor.clientId === selectionFocus.clientId) { + return EMPTY_ARRAY; + } // Can't split if the selection is not set. + + + if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') { + return EMPTY_ARRAY; + } + + const anchorRootClientId = getBlockRootClientId(state, selectionAnchor.clientId); + const focusRootClientId = getBlockRootClientId(state, selectionFocus.clientId); // It's not splittable if the selection doesn't start and end in the same + // block list. Maybe in the future it should be allowed. + + if (anchorRootClientId !== focusRootClientId) { + return EMPTY_ARRAY; + } + + const blockOrder = getBlockOrder(state, anchorRootClientId); + const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId); + const focusIndex = blockOrder.indexOf(selectionFocus.clientId); // Reassign selection start and end based on order. + + const [selectionStart, selectionEnd] = anchorIndex > focusIndex ? [selectionFocus, selectionAnchor] : [selectionAnchor, selectionFocus]; + const blockA = getBlock(state, selectionStart.clientId); + const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name); + const blockB = getBlock(state, selectionEnd.clientId); + const blockBType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockB.name); + const htmlA = blockA.attributes[selectionStart.attributeKey]; + const htmlB = blockB.attributes[selectionEnd.attributeKey]; + const attributeDefinitionA = blockAType.attributes[selectionStart.attributeKey]; + const attributeDefinitionB = blockBType.attributes[selectionEnd.attributeKey]; + let valueA = (0,external_wp_richText_namespaceObject.create)({ + html: htmlA, + ...mapRichTextSettings(attributeDefinitionA) + }); + let valueB = (0,external_wp_richText_namespaceObject.create)({ + html: htmlB, + ...mapRichTextSettings(attributeDefinitionB) + }); + valueA = (0,external_wp_richText_namespaceObject.remove)(valueA, 0, selectionStart.offset); + valueB = (0,external_wp_richText_namespaceObject.remove)(valueB, selectionEnd.offset, valueB.text.length); + return [{ ...blockA, + attributes: { ...blockA.attributes, + [selectionStart.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ + value: valueA, + ...mapRichTextSettings(attributeDefinitionA) + }) + } + }, { ...blockB, + attributes: { ...blockB.attributes, + [selectionEnd.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ + value: valueB, + ...mapRichTextSettings(attributeDefinitionB) + }) + } + }]; +}; +/** * 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. @@ -10064,22 +6391,22 @@ * @return {Array} Ordered client IDs of editor blocks. */ -function selectors_getBlockOrder(state, rootClientId) { +function getBlockOrder(state, rootClientId) { return state.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. + * @param {Object} state Editor state. + * @param {string} clientId Block client ID. * * @return {number} Index at which block exists in order. */ -function selectors_getBlockIndex(state, clientId, rootClientId) { - return selectors_getBlockOrder(state, rootClientId).indexOf(clientId); +function getBlockIndex(state, clientId) { + const rootClientId = getBlockRootClientId(state, clientId); + return getBlockOrder(state, rootClientId).indexOf(clientId); } /** * Returns true if the block corresponding to the specified client ID is @@ -10091,7 +6418,7 @@ * @return {boolean} Whether block is selected and multi-selection exists. */ -function selectors_isBlockSelected(state, clientId) { +function isBlockSelected(state, clientId) { const { selectionStart, selectionEnd @@ -10113,8 +6440,9 @@ * @return {boolean} Whether the block as an inner block selected */ -function selectors_hasSelectedInnerBlock(state, clientId, deep = false) { - return Object(external_lodash_["some"])(selectors_getBlockOrder(state, clientId), innerClientId => selectors_isBlockSelected(state, innerClientId) || selectors_isBlockMultiSelected(state, innerClientId) || deep && selectors_hasSelectedInnerBlock(state, innerClientId, deep)); +function hasSelectedInnerBlock(state, clientId) { + let deep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + return (0,external_lodash_namespaceObject.some)(getBlockOrder(state, clientId), innerClientId => isBlockSelected(state, innerClientId) || isBlockMultiSelected(state, innerClientId) || deep && hasSelectedInnerBlock(state, innerClientId, deep)); } /** * Returns true if the block corresponding to the specified client ID is @@ -10134,7 +6462,7 @@ return false; } - const clientIds = selectors_getMultiSelectedBlockClientIds(state); + const clientIds = getMultiSelectedBlockClientIds(state); const index = clientIds.indexOf(clientId); return index > -1 && index < clientIds.length - 1; } @@ -10146,7 +6474,7 @@ * @return {boolean} Whether multi-selection has been made. */ -function selectors_hasMultiSelection(state) { +function hasMultiSelection(state) { const { selectionStart, selectionEnd @@ -10189,7 +6517,7 @@ * @return {Object} Block editing mode. */ -function selectors_getBlockMode(state, clientId) { +function getBlockMode(state, clientId) { return state.blocksMode[clientId] || 'visual'; } /** @@ -10224,7 +6552,7 @@ * @return {string[]} Array of dragged block client ids. */ -function selectors_getDraggedBlockClientIds(state) { +function getDraggedBlockClientIds(state) { return state.draggedBlocks; } /** @@ -10240,7 +6568,7 @@ * @return {boolean} Whether the block is being dragged. */ -function selectors_isBlockBeingDragged(state, clientId) { +function isBlockBeingDragged(state, clientId) { return state.draggedBlocks.includes(clientId); } /** @@ -10252,15 +6580,15 @@ * @return {boolean} Whether the block's ancestor is being dragged. */ -function selectors_isAncestorBeingDragged(state, clientId) { +function isAncestorBeingDragged(state, clientId) { // Return early if no blocks are being dragged rather than // the more expensive check for parents. if (!isDraggingBlocks(state)) { return false; } - const parents = selectors_getBlockParents(state, clientId); - return Object(external_lodash_["some"])(parents, parentClientId => selectors_isBlockBeingDragged(state, parentClientId)); + const parents = getBlockParents(state, clientId); + return (0,external_lodash_namespaceObject.some)(parents, parentClientId => isBlockBeingDragged(state, parentClientId)); } /** * Returns true if the caret is within formatted text, or false otherwise. @@ -10282,7 +6610,7 @@ * @return {Object} Insertion point object with `rootClientId`, `index`. */ -function selectors_getBlockInsertionPoint(state) { +function getBlockInsertionPoint(state) { let rootClientId, index; const { insertionPoint, @@ -10300,10 +6628,10 @@ } = selectionEnd; if (clientId) { - rootClientId = selectors_getBlockRootClientId(state, clientId) || undefined; - index = selectors_getBlockIndex(state, selectionEnd.clientId, rootClientId) + 1; + rootClientId = getBlockRootClientId(state, clientId) || undefined; + index = getBlockIndex(state, selectionEnd.clientId, rootClientId) + 1; } else { - index = selectors_getBlockOrder(state).length; + index = getBlockOrder(state).length; } return { @@ -10319,7 +6647,7 @@ * @return {?boolean} Whether the insertion point is visible or not. */ -function selectors_isBlockInsertionPointVisible(state) { +function isBlockInsertionPointVisible(state) { return state.insertionPoint !== null; } /** @@ -10329,14 +6657,15 @@ * @return {?boolean} Whether the template is valid or not. */ -function selectors_isValidTemplate(state) { +function isValidTemplate(state) { return state.template.isValid; } /** * Returns the defined block template * * @param {boolean} state - * @return {?Array} Block Template + * + * @return {?Array} Block Template. */ function getTemplate(state) { @@ -10352,12 +6681,12 @@ * @return {?string} Block Template Lock */ -function selectors_getTemplateLock(state, rootClientId) { +function getTemplateLock(state, rootClientId) { if (!rootClientId) { return state.settings.templateLock; } - const blockListSettings = selectors_getBlockListSettings(state, rootClientId); + const blockListSettings = getBlockListSettings(state, rootClientId); if (!blockListSettings) { return null; @@ -10366,12 +6695,14 @@ return blockListSettings.templateLock; } -const checkAllowList = (list, item, defaultResult = null) => { - if (Object(external_lodash_["isBoolean"])(list)) { +const checkAllowList = function (list, item) { + let defaultResult = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + + if ((0,external_lodash_namespaceObject.isBoolean)(list)) { return list; } - if (Object(external_lodash_["isArray"])(list)) { + if ((0,external_lodash_namespaceObject.isArray)(list)) { // TODO: when there is a canonical way to detect that we are editing a post // the following check should be changed to something like: // if ( list.includes( 'core/post-content' ) && getEditorMode() === 'post-content' && item === null ) @@ -10389,24 +6720,25 @@ * 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|Object} blockName The block type object, e.g., the response - * from the block directory; or a string name of - * an installed block type, e.g.' core/paragraph'. - * @param {?string} rootClientId Optional root client ID of block list. + * @param {Object} state Editor state. + * @param {string|Object} blockName The block type object, e.g., the response + * from the block directory; or a string name of + * an installed 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. */ -const canInsertBlockTypeUnmemoized = (state, blockName, rootClientId = null) => { +const canInsertBlockTypeUnmemoized = function (state, blockName) { + let rootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; let blockType; if (blockName && 'object' === typeof blockName) { blockType = blockName; blockName = blockType.name; } else { - blockType = Object(external_wp_blocks_["getBlockType"])(blockName); + blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); } if (!blockType) { @@ -10415,20 +6747,20 @@ const { allowedBlockTypes - } = selectors_getSettings(state); + } = getSettings(state); const isBlockAllowedInEditor = checkAllowList(allowedBlockTypes, blockName, true); if (!isBlockAllowedInEditor) { return false; } - const isLocked = !!selectors_getTemplateLock(state, rootClientId); + const isLocked = !!getTemplateLock(state, rootClientId); if (isLocked) { return false; } - const parentBlockListSettings = selectors_getBlockListSettings(state, rootClientId); // The parent block doesn't have settings indicating it doesn't support + const parentBlockListSettings = getBlockListSettings(state, rootClientId); // The parent block doesn't have settings indicating it doesn't support // inner blocks, return false. if (rootClientId && parentBlockListSettings === undefined) { @@ -10438,18 +6770,42 @@ const parentAllowedBlocks = parentBlockListSettings === null || parentBlockListSettings === void 0 ? void 0 : parentBlockListSettings.allowedBlocks; const hasParentAllowedBlock = checkAllowList(parentAllowedBlocks, blockName); const blockAllowedParentBlocks = blockType.parent; - const parentName = selectors_getBlockName(state, rootClientId); + const parentName = getBlockName(state, rootClientId); const 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; + let hasBlockAllowedAncestor = true; + const blockAllowedAncestorBlocks = blockType.ancestor; + + if (blockAllowedAncestorBlocks) { + const ancestors = [rootClientId, ...getBlockParents(state, rootClientId)]; + hasBlockAllowedAncestor = (0,external_lodash_namespaceObject.some)(ancestors, ancestorClientId => checkAllowList(blockAllowedAncestorBlocks, getBlockName(state, ancestorClientId))); + } + + const canInsert = hasBlockAllowedAncestor && (hasParentAllowedBlock === null && hasBlockAllowedParent === null || hasParentAllowedBlock === true || hasBlockAllowedParent === true); + + if (!canInsert) { + return canInsert; + } + /** + * This filter is an ad-hoc solution to prevent adding template parts inside post content. + * Conceptually, having a filter inside a selector is bad pattern so this code will be + * replaced by a declarative API that doesn't the following drawbacks: + * + * Filters are not reactive: Upon switching between "template mode" and non "template mode", + * the filter and selector won't necessarily be executed again. For now, it doesn't matter much + * because you can't switch between the two modes while the inserter stays open. + * + * Filters are global: Once they're defined, they will affect all editor instances and all registries. + * An ideal API would only affect specific editor instances. + */ + + + return (0,external_wp_hooks_namespaceObject.applyFilters)('blockEditor.__unstableCanInsertBlockType', canInsert, blockType, rootClientId, { + // Pass bound selectors of the current registry. If we're in a nested + // context, the data will differ from the one selected from the root + // registry. + getBlock: getBlock.bind(null, state), + getBlockParentsByBlockName: getBlockParentsByBlockName.bind(null, state) + }); }; /** * Determines if the given block type is allowed to be inserted into the block list. @@ -10462,7 +6818,7 @@ */ -const selectors_canInsertBlockType = Object(rememo["a" /* default */])(canInsertBlockTypeUnmemoized, (state, blockName, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId[rootClientId], state.settings.allowedBlockTypes, state.settings.templateLock]); +const canInsertBlockType = rememo(canInsertBlockTypeUnmemoized, (state, blockName, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId[rootClientId], state.settings.allowedBlockTypes, state.settings.templateLock]); /** * Determines if the given blocks are allowed to be inserted into the block * list. @@ -10474,8 +6830,116 @@ * @return {boolean} Whether the given blocks are allowed to be inserted. */ -function selectors_canInsertBlocks(state, clientIds, rootClientId = null) { - return clientIds.every(id => selectors_canInsertBlockType(state, selectors_getBlockName(state, id), rootClientId)); +function canInsertBlocks(state, clientIds) { + let rootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + return clientIds.every(id => canInsertBlockType(state, getBlockName(state, id), rootClientId)); +} +/** + * Determines if the given block is allowed to be deleted. + * + * @param {Object} state Editor state. + * @param {string} clientId The block client Id. + * @param {?string} rootClientId Optional root client ID of block list. + * + * @return {boolean} Whether the given block is allowed to be removed. + */ + +function canRemoveBlock(state, clientId) { + let rootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + const attributes = getBlockAttributes(state, clientId); // attributes can be null if the block is already deleted. + + if (attributes === null) { + return true; + } + + const { + lock + } = attributes; + const parentIsLocked = !!getTemplateLock(state, rootClientId); // If we don't have a lock on the blockType level, we defer to the parent templateLock. + + if (lock === undefined || (lock === null || lock === void 0 ? void 0 : lock.remove) === undefined) { + return !parentIsLocked; + } // When remove is true, it means we cannot remove it. + + + return !(lock !== null && lock !== void 0 && lock.remove); +} +/** + * Determines if the given blocks are allowed to be removed. + * + * @param {Object} state Editor state. + * @param {string} clientIds The block client IDs to be removed. + * @param {?string} rootClientId Optional root client ID of block list. + * + * @return {boolean} Whether the given blocks are allowed to be removed. + */ + +function canRemoveBlocks(state, clientIds) { + let rootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + return clientIds.every(clientId => canRemoveBlock(state, clientId, rootClientId)); +} +/** + * Determines if the given block is allowed to be moved. + * + * @param {Object} state Editor state. + * @param {string} clientId The block client Id. + * @param {?string} rootClientId Optional root client ID of block list. + * + * @return {boolean} Whether the given block is allowed to be moved. + */ + +function canMoveBlock(state, clientId) { + let rootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + const attributes = getBlockAttributes(state, clientId); + + if (attributes === null) { + return; + } + + const { + lock + } = attributes; + const parentIsLocked = getTemplateLock(state, rootClientId) === 'all'; // If we don't have a lock on the blockType level, we defer to the parent templateLock. + + if (lock === undefined || (lock === null || lock === void 0 ? void 0 : lock.move) === undefined) { + return !parentIsLocked; + } // When move is true, it means we cannot move it. + + + return !(lock !== null && lock !== void 0 && lock.move); +} +/** + * Determines if the given blocks are allowed to be moved. + * + * @param {Object} state Editor state. + * @param {string} clientIds The block client IDs to be moved. + * @param {?string} rootClientId Optional root client ID of block list. + * + * @return {boolean} Whether the given blocks are allowed to be moved. + */ + +function canMoveBlocks(state, clientIds) { + let rootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + return clientIds.every(clientId => canMoveBlock(state, clientId, rootClientId)); +} +/** + * Determines if the given block type can be locked/unlocked by a user. + * + * @param {Object} state Editor state. + * @param {(string|Object)} nameOrType Block name or type object. + * + * @return {boolean} Whether a given block type can be locked/unlocked. + */ + +function canLockBlockType(state, nameOrType) { + var _state$settings; + + if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, 'lock', true)) { + return false; + } // Use block editor settings as the default value. + + + return !!((_state$settings = state.settings) !== null && _state$settings !== void 0 && _state$settings.canLockBlocks); } /** * Returns information about how recently and frequently a block has been inserted. @@ -10496,8 +6960,8 @@ /** * Returns whether we can show a block type in the inserter * - * @param {Object} state Global State - * @param {Object} blockType BlockType + * @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. @@ -10505,7 +6969,7 @@ const canIncludeBlockTypeInInserter = (state, blockType, rootClientId) => { - if (!Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'inserter', true)) { + if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'inserter', true)) { return false; } @@ -10515,7 +6979,7 @@ * Return a function to be used to tranform a block variation to an inserter item * * @param {Object} state Global State - * @param {Object} item Denormalized inserter item + * @param {Object} item Denormalized inserter item * @return {Function} Function to transform a block variation to inserter item */ @@ -10548,7 +7012,7 @@ * 'frecency' is a heuristic (https://en.wikipedia.org/wiki/Frecency) * that combines block usage frequenty and recency. * - * @param {number} time When the last insert occurred as a UNIX epoch + * @param {number} time When the last insert occurred as a UNIX epoch * @param {number} count The number of inserts that have occurred. * * @return {number} The calculated frecency. @@ -10583,50 +7047,51 @@ * in a specific context. It's used for building items for Inserter and available * block Transfroms list. * - * @param {Object} state Editor state. - * @param {Object} options Options object for handling the building of a block type. + * @param {Object} state Editor state. + * @param {Object} options Options object for handling the building of a block type. * @param {string} options.buildScope The scope for which the item is going to be used. * @return {Function} Function returns an item to be shown in a specific context (Inserter|Transforms list). */ -const buildBlockTypeItem = (state, { - buildScope = 'inserter' -}) => blockType => { - const id = blockType.name; - let isDisabled = false; - - if (!Object(external_wp_blocks_["hasBlockSupport"])(blockType.name, 'multiple', true)) { - isDisabled = Object(external_lodash_["some"])(selectors_getBlocksByClientId(state, getClientIdsWithDescendants(state)), { - name: blockType.name - }); - } - - const { - time, - count = 0 - } = getInsertUsage(state, id) || {}; - const blockItemBase = { - id, - name: blockType.name, - title: blockType.title, - icon: blockType.icon, - isDisabled, - frecency: calculateFrecency(time, count) - }; - if (buildScope === 'transform') return blockItemBase; - const inserterVariations = blockType.variations.filter(({ - scope - }) => !scope || scope.includes('inserter')); - return { ...blockItemBase, - initialAttributes: {}, - description: blockType.description, - category: blockType.category, - keywords: blockType.keywords, - variations: inserterVariations, - example: blockType.example, - utility: 1 // deprecated - +const buildBlockTypeItem = (state, _ref3) => { + let { + buildScope = 'inserter' + } = _ref3; + return blockType => { + const id = blockType.name; + let isDisabled = false; + + if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType.name, 'multiple', true)) { + isDisabled = (0,external_lodash_namespaceObject.some)(getBlocksByClientId(state, getClientIdsWithDescendants(state)), { + name: blockType.name + }); + } + + const { + time, + count = 0 + } = getInsertUsage(state, id) || {}; + const blockItemBase = { + id, + name: blockType.name, + title: blockType.title, + icon: blockType.icon, + isDisabled, + frecency: calculateFrecency(time, count) + }; + if (buildScope === 'transform') return blockItemBase; + const inserterVariations = (0,external_wp_blocks_namespaceObject.getBlockVariations)(blockType.name, 'inserter'); + return { ...blockItemBase, + initialAttributes: {}, + description: blockType.description, + category: blockType.category, + keywords: blockType.keywords, + variations: inserterVariations, + example: blockType.example, + utility: 1 // Deprecated. + + }; }; }; /** @@ -10641,8 +7106,8 @@ * * 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. + * @param {Object} state Editor state. + * @param {?string} rootClientId Optional root client ID of block list. * * @return {WPEditorInserterItem[]} Items that appear in inserter. * @@ -10660,22 +7125,53 @@ */ -const selectors_getInserterItems = Object(rememo["a" /* default */])((state, rootClientId = null) => { +const getInserterItems = rememo(function (state) { + let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; const buildBlockTypeInserterItem = buildBlockTypeItem(state, { buildScope: 'inserter' }); + /* + * Matches block comment delimiters amid serialized content. + * + * @see `tokenizer` in `@wordpress/block-serialization-default-parser` + * package + * + * blockParserTokenizer differs from the original tokenizer in the + * following ways: + * + * - removed global flag (/g) + * - prepended ^\s* + * + */ + + const blockParserTokenizer = /^\s*)[^])*)\5|[^]*?)}\s+)?(\/)?-->/; const buildReusableBlockInserterItem = reusableBlock => { + let icon = library_symbol; + /* + * Instead of always displaying a generic "symbol" icon for every + * reusable block, try to use an icon that represents the first + * outermost block contained in the reusable block. This requires + * scanning the serialized form of the reusable block to find its + * first block delimiter, then looking up the corresponding block + * type, if available. + */ + + if (external_wp_element_namespaceObject.Platform.OS === 'web') { + const content = typeof reusableBlock.content.raw === 'string' ? reusableBlock.content.raw : reusableBlock.content; + const rawBlockMatch = content.match(blockParserTokenizer); + + if (rawBlockMatch) { + const [,, namespace = 'core/', blockName] = rawBlockMatch; + const referencedBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(namespace + blockName); + + if (referencedBlockType) { + icon = referencedBlockType.icon; + } + } + } + const id = `core/block/${reusableBlock.id}`; - - const referencedBlocks = __experimentalGetParsedReusableBlock(state, reusableBlock.id); - - let referencedBlockType; - - if (referencedBlocks.length === 1) { - referencedBlockType = Object(external_wp_blocks_["getBlockType"])(referencedBlocks[0].name); - } - const { time, count = 0 @@ -10688,59 +7184,64 @@ ref: reusableBlock.id }, title: reusableBlock.title.raw, - icon: referencedBlockType ? referencedBlockType.icon : templateIcon, + icon, category: 'reusable', keywords: [], isDisabled: false, utility: 1, - // deprecated + // Deprecated. frecency }; }; - const blockTypeInserterItems = Object(external_wp_blocks_["getBlockTypes"])().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeInserterItem); - const reusableBlockInserterItems = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) ? getReusableBlocks(state).map(buildReusableBlockInserterItem) : []; // Exclude any block type item that is to be replaced by a default - // variation. - - const visibleBlockTypeInserterItems = blockTypeInserterItems.filter(({ - variations = [] - }) => !variations.some(({ - isDefault - }) => isDefault)); - const blockVariations = []; // Show all available blocks with variations - - for (const item of blockTypeInserterItems) { + const blockTypeInserterItems = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeInserterItem); + const reusableBlockInserterItems = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) ? getReusableBlocks(state).map(buildReusableBlockInserterItem) : []; + const items = blockTypeInserterItems.reduce((accumulator, item) => { const { variations = [] - } = item; + } = item; // Exclude any block type item that is to be replaced by a default variation. + + if (!variations.some(_ref4 => { + let { + isDefault + } = _ref4; + return isDefault; + })) { + accumulator.push(item); + } if (variations.length) { const variationMapper = getItemFromVariation(state, item); - blockVariations.push(...variations.map(variationMapper)); - } - } // Prioritize core blocks's display in inserter. - - - const prioritizeCoreBlocks = (a, b) => { - const coreBlockNamePrefix = 'core/'; - const firstIsCoreBlock = a.name.startsWith(coreBlockNamePrefix); - const secondIsCoreBlock = b.name.startsWith(coreBlockNamePrefix); - - if (firstIsCoreBlock && secondIsCoreBlock) { - return 0; - } - - return firstIsCoreBlock && !secondIsCoreBlock ? -1 : 1; - }; // Ensure core blocks are prioritized in the returned results, + accumulator.push(...variations.map(variationMapper)); + } + + return accumulator; + }, []); // Ensure core blocks are prioritized in the returned results, // because third party blocks can be registered earlier than // the core blocks (usually by using the `init` action), // thus affecting the display order. // We don't sort reusable blocks as they are handled differently. - - const sortedBlockTypes = [...visibleBlockTypeInserterItems, ...blockVariations].sort(prioritizeCoreBlocks); + const groupByType = (blocks, block) => { + const { + core, + noncore + } = blocks; + const type = block.name.startsWith('core/') ? core : noncore; + type.push(block); + return blocks; + }; + + const { + core: coreItems, + noncore: nonCoreItems + } = items.reduce(groupByType, { + core: [], + noncore: [] + }); + const sortedBlockTypes = [...coreItems, ...nonCoreItems]; return [...sortedBlockTypes, ...reusableBlockInserterItems]; -}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.blocks.order, state.preferences.insertUsage, state.settings.allowedBlockTypes, state.settings.templateLock, getReusableBlocks(state), Object(external_wp_blocks_["getBlockTypes"])()]); +}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.blocks.order, state.preferences.insertUsage, state.settings.allowedBlockTypes, state.settings.templateLock, getReusableBlocks(state), (0,external_wp_blocks_namespaceObject.getBlockTypes)()]); /** * Determines the items that appear in the available block transforms list. * @@ -10752,39 +7253,56 @@ * * Items are returned ordered descendingly by their 'frecency'. * - * @param {Object} state Editor state. - * @param {?string} rootClientId Optional root client ID of block list. + * @param {Object} state Editor state. + * @param {?string} rootClientId Optional root client ID of block list. * * @return {WPEditorTransformItem[]} Items that appear in inserter. * * @typedef {Object} WPEditorTransformItem - * @property {string} id Unique identifier for the item. - * @property {string} name The type of block to create. - * @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 {boolean} isDisabled Whether or not the user should be prevented from inserting - * this item. - * @property {number} frecency Heuristic that combines frequency and recency. - */ - -const selectors_getBlockTransformItems = Object(rememo["a" /* default */])((state, blocks, rootClientId = null) => { + * @property {string} id Unique identifier for the item. + * @property {string} name The type of block to create. + * @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 {boolean} isDisabled Whether or not the user should be prevented from inserting + * this item. + * @property {number} frecency Heuristic that combines frequency and recency. + */ + +const getBlockTransformItems = rememo(function (state, blocks) { + var _itemsByName$sourceBl; + + let rootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + const [sourceBlock] = blocks; const buildBlockTypeTransformItem = buildBlockTypeItem(state, { buildScope: 'transform' }); - const blockTypeTransformItems = Object(external_wp_blocks_["getBlockTypes"])().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeTransformItem); - const itemsByName = Object(external_lodash_["mapKeys"])(blockTypeTransformItems, ({ - name - }) => name); - const possibleTransforms = Object(external_wp_blocks_["getPossibleBlockTransformations"])(blocks).reduce((accumulator, block) => { - if (itemsByName[block === null || block === void 0 ? void 0 : block.name]) { + const blockTypeTransformItems = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeTransformItem); + const itemsByName = (0,external_lodash_namespaceObject.mapKeys)(blockTypeTransformItems, _ref5 => { + let { + name + } = _ref5; + return name; + }); // Consider unwraping the highest priority. + + itemsByName['*'] = { + frecency: +Infinity, + id: '*', + isDisabled: false, + name: '*', + title: (0,external_wp_i18n_namespaceObject.__)('Unwrap'), + icon: (_itemsByName$sourceBl = itemsByName[sourceBlock.name]) === null || _itemsByName$sourceBl === void 0 ? void 0 : _itemsByName$sourceBl.icon + }; + const possibleTransforms = (0,external_wp_blocks_namespaceObject.getPossibleBlockTransformations)(blocks).reduce((accumulator, block) => { + if (block === '*') { + accumulator.push(itemsByName['*']); + } else if (itemsByName[block === null || block === void 0 ? void 0 : block.name]) { accumulator.push(itemsByName[block.name]); } return accumulator; }, []); - const possibleBlockTransformations = Object(external_lodash_["orderBy"])(possibleTransforms, block => itemsByName[block.name].frecency, 'desc'); - return possibleBlockTransformations; -}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.preferences.insertUsage, state.settings.allowedBlockTypes, state.settings.templateLock, Object(external_wp_blocks_["getBlockTypes"])()]); + return (0,external_lodash_namespaceObject.orderBy)(possibleTransforms, block => itemsByName[block.name].frecency, 'desc'); +}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.preferences.insertUsage, state.settings.allowedBlockTypes, state.settings.templateLock, (0,external_wp_blocks_namespaceObject.getBlockTypes)()]); /** * Determines whether there are items to show in the inserter. * @@ -10794,8 +7312,9 @@ * @return {boolean} Items that appear in inserter. */ -const selectors_hasInserterItems = Object(rememo["a" /* default */])((state, rootClientId = null) => { - const hasBlockType = Object(external_lodash_["some"])(Object(external_wp_blocks_["getBlockTypes"])(), blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)); +const hasInserterItems = rememo(function (state) { + let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + const hasBlockType = (0,external_lodash_namespaceObject.some)((0,external_wp_blocks_namespaceObject.getBlockTypes)(), blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)); if (hasBlockType) { return true; @@ -10803,7 +7322,7 @@ const hasReusableBlock = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) && getReusableBlocks(state).length > 0; return hasReusableBlock; -}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.settings.allowedBlockTypes, state.settings.templateLock, getReusableBlocks(state), Object(external_wp_blocks_["getBlockTypes"])()]); +}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.settings.allowedBlockTypes, state.settings.templateLock, getReusableBlocks(state), (0,external_wp_blocks_namespaceObject.getBlockTypes)()]); /** * Returns the list of allowed inserter blocks for inner blocks children * @@ -10813,16 +7332,54 @@ * @return {Array?} The list of allowed block types. */ -const selectors_experimentalGetAllowedBlocks = Object(rememo["a" /* default */])((state, rootClientId = null) => { +const __experimentalGetAllowedBlocks = rememo(function (state) { + let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + if (!rootClientId) { return; } - return Object(external_lodash_["filter"])(Object(external_wp_blocks_["getBlockTypes"])(), blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)); -}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.settings.allowedBlockTypes, state.settings.templateLock, Object(external_wp_blocks_["getBlockTypes"])()]); + return (0,external_lodash_namespaceObject.filter)((0,external_wp_blocks_namespaceObject.getBlockTypes)(), blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)); +}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.settings.allowedBlockTypes, state.settings.templateLock, (0,external_wp_blocks_namespaceObject.getBlockTypes)()]); +/** + * Returns the block to be directly inserted by the block appender. + * + * @param {Object} state Editor state. + * @param {?string} rootClientId Optional root client ID of block list. + * + * @return {?WPDirectInsertBlock} The block type to be directly inserted. + * + * @typedef {Object} WPDirectInsertBlock + * @property {string} name The type of block. + * @property {?Object} attributes Attributes to pass to the newly created block. + * @property {?Array} attributesToCopy Attributes to be copied from adjecent blocks when inserted. + */ + +const __experimentalGetDirectInsertBlock = rememo(function (state) { + var _state$blockListSetti, _state$blockListSetti2; + + let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + + if (!rootClientId) { + return; + } + + const defaultBlock = (_state$blockListSetti = state.blockListSettings[rootClientId]) === null || _state$blockListSetti === void 0 ? void 0 : _state$blockListSetti.__experimentalDefaultBlock; + const directInsert = (_state$blockListSetti2 = state.blockListSettings[rootClientId]) === null || _state$blockListSetti2 === void 0 ? void 0 : _state$blockListSetti2.__experimentalDirectInsert; + + if (!defaultBlock || !directInsert) { + return; + } + + if (typeof directInsert === 'function') { + return directInsert(getBlock(state, rootClientId)) ? defaultBlock : null; + } + + return defaultBlock; +}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.tree[rootClientId]]); const checkAllowListRecursive = (blocks, allowedBlockTypes) => { - if (Object(external_lodash_["isBoolean"])(allowedBlockTypes)) { + if ((0,external_lodash_namespaceObject.isBoolean)(allowedBlockTypes)) { return allowedBlockTypes; } @@ -10846,31 +7403,47 @@ return true; }; -const __experimentalGetParsedPattern = Object(rememo["a" /* default */])((state, patternName) => { +const __experimentalGetParsedPattern = rememo((state, patternName) => { const patterns = state.settings.__experimentalBlockPatterns; - const pattern = patterns.find(({ - name - }) => name === patternName); + const pattern = patterns.find(_ref6 => { + let { + name + } = _ref6; + return name === patternName; + }); if (!pattern) { return null; } return { ...pattern, - blocks: Object(external_wp_blocks_["parse"])(pattern.content) + blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, { + __unstableSkipMigrationLogs: true + }) }; }, state => [state.settings.__experimentalBlockPatterns]); -const getAllAllowedPatterns = Object(rememo["a" /* default */])(state => { +const getAllAllowedPatterns = rememo(state => { const patterns = state.settings.__experimentalBlockPatterns; const { allowedBlockTypes - } = selectors_getSettings(state); - const parsedPatterns = patterns.map(({ - name - }) => __experimentalGetParsedPattern(state, name)); - const allowedPatterns = parsedPatterns.filter(({ - blocks - }) => checkAllowListRecursive(blocks, allowedBlockTypes)); + } = getSettings(state); + const parsedPatterns = patterns.filter(_ref7 => { + let { + inserter = true + } = _ref7; + return !!inserter; + }).map(_ref8 => { + let { + name + } = _ref8; + return __experimentalGetParsedPattern(state, name); + }); + const allowedPatterns = parsedPatterns.filter(_ref9 => { + let { + blocks + } = _ref9; + return checkAllowListRecursive(blocks, allowedBlockTypes); + }); return allowedPatterns; }, state => [state.settings.__experimentalBlockPatterns, state.settings.allowedBlockTypes]); /** @@ -10882,13 +7455,20 @@ * @return {Array?} The list of allowed patterns. */ -const selectors_experimentalGetAllowedPatterns = Object(rememo["a" /* default */])((state, rootClientId = null) => { +const __experimentalGetAllowedPatterns = rememo(function (state) { + let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; const availableParsedPatterns = getAllAllowedPatterns(state); - const patternsAllowed = Object(external_lodash_["filter"])(availableParsedPatterns, ({ - blocks - }) => blocks.every(({ - name - }) => selectors_canInsertBlockType(state, name, rootClientId))); + const patternsAllowed = (0,external_lodash_namespaceObject.filter)(availableParsedPatterns, _ref10 => { + let { + blocks + } = _ref10; + return blocks.every(_ref11 => { + let { + name + } = _ref11; + return canInsertBlockType(state, name, rootClientId); + }); + }); return patternsAllowed; }, (state, rootClientId) => [state.settings.__experimentalBlockPatterns, state.settings.allowedBlockTypes, state.settings.templateLock, state.blockListSettings[rootClientId], state.blocks.byClientId[rootClientId]]); /** @@ -10898,17 +7478,18 @@ * suggesting appropriate patterns in a Placeholder state(during insertion) * or blocks transformations. * - * @param {Object} state Editor state. - * @param {string|string[]} blockNames Block's name or array of block names to find matching pattens. - * @param {?string} rootClientId Optional target root client ID. + * @param {Object} state Editor state. + * @param {string|string[]} blockNames Block's name or array of block names to find matching pattens. + * @param {?string} rootClientId Optional target root client ID. * * @return {Array} The list of matched block patterns based on declared `blockTypes` and block name. */ -const selectors_experimentalGetPatternsByBlockTypes = Object(rememo["a" /* default */])((state, blockNames, rootClientId = null) => { +const __experimentalGetPatternsByBlockTypes = rememo(function (state, blockNames) { + let rootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; if (!blockNames) return EMPTY_ARRAY; - const patterns = selectors_experimentalGetAllowedPatterns(state, rootClientId); + const patterns = __experimentalGetAllowedPatterns(state, rootClientId); const normalizedBlockNames = Array.isArray(blockNames) ? blockNames : [blockNames]; return patterns.filter(pattern => { @@ -10916,7 +7497,7 @@ return pattern === null || pattern === void 0 ? void 0 : (_pattern$blockTypes = pattern.blockTypes) === null || _pattern$blockTypes === void 0 ? void 0 : (_pattern$blockTypes$s = _pattern$blockTypes.some) === null || _pattern$blockTypes$s === void 0 ? void 0 : _pattern$blockTypes$s.call(_pattern$blockTypes, blockName => normalizedBlockNames.includes(blockName)); }); -}, (state, rootClientId) => [...selectors_experimentalGetAllowedPatterns.getDependants(state, rootClientId)]); +}, (state, rootClientId) => [...__experimentalGetAllowedPatterns.getDependants(state, rootClientId)]); /** * Determines the items that appear in the available pattern transforms list. * @@ -10928,14 +7509,15 @@ * block pattern's blocks and try to find matches from the selected blocks. * Now this happens in the consumer to avoid heavy operations in the selector. * - * @param {Object} state Editor state. - * @param {Object[]} blocks The selected blocks. - * @param {?string} rootClientId Optional root client ID of block list. + * @param {Object} state Editor state. + * @param {Object[]} blocks The selected blocks. + * @param {?string} rootClientId Optional root client ID of block list. * * @return {WPBlockPattern[]} Items that are eligible for a pattern transformation. */ -const selectors_experimentalGetPatternTransformItems = Object(rememo["a" /* default */])((state, blocks, rootClientId = null) => { +const __experimentalGetPatternTransformItems = rememo(function (state, blocks) { + let rootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; if (!blocks) return EMPTY_ARRAY; /** * For now we only handle blocks without InnerBlocks and take into account @@ -10945,17 +7527,23 @@ * to check for this case too. */ - if (blocks.some(({ - clientId, - innerBlocks - }) => innerBlocks.length || areInnerBlocksControlled(state, clientId))) { + if (blocks.some(_ref12 => { + let { + clientId, + innerBlocks + } = _ref12; + return innerBlocks.length || areInnerBlocksControlled(state, clientId); + })) { return EMPTY_ARRAY; } // Create a Set of the selected block names that is used in patterns filtering. - const selectedBlockNames = Array.from(new Set(blocks.map(({ - name - }) => name))); + const selectedBlockNames = Array.from(new Set(blocks.map(_ref13 => { + let { + name + } = _ref13; + return name; + }))); /** * Here we will return first set of possible eligible block patterns, * by checking the `blockTypes` property. We still have to recurse through @@ -10963,8 +7551,8 @@ * Now this happens in the consumer to avoid heavy operations in the selector. */ - return selectors_experimentalGetPatternsByBlockTypes(state, selectedBlockNames, rootClientId); -}, (state, rootClientId) => [...selectors_experimentalGetPatternsByBlockTypes.getDependants(state, rootClientId)]); + return __experimentalGetPatternsByBlockTypes(state, selectedBlockNames, rootClientId); +}, (state, rootClientId) => [...__experimentalGetPatternsByBlockTypes.getDependants(state, rootClientId)]); /** * Returns the Block List settings of a block, if any exist. * @@ -10974,7 +7562,7 @@ * @return {?Object} Block settings of the block if set. */ -function selectors_getBlockListSettings(state, clientId) { +function getBlockListSettings(state, clientId) { return state.blockListSettings[clientId]; } /** @@ -10985,7 +7573,7 @@ * @return {Object} The editor settings object. */ -function selectors_getSettings(state) { +function getSettings(state) { return state.settings; } /** @@ -10998,7 +7586,7 @@ * @return {boolean} Whether the most recent block change was persistent. */ -function selectors_isLastBlockChangePersistent(state) { +function isLastBlockChangePersistent(state) { return state.blocks.isPersistentChange; } /** @@ -11011,7 +7599,8 @@ * a block list setting object. */ -const selectors_experimentalGetBlockListSettingsForBlocks = Object(rememo["a" /* default */])((state, clientIds = []) => { +const __experimentalGetBlockListSettingsForBlocks = rememo(function (state) { + let clientIds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; return clientIds.reduce((blockListSettingsForBlocks, clientId) => { if (!state.blockListSettings[clientId]) { return blockListSettingsForBlocks; @@ -11023,26 +7612,6 @@ }, {}); }, state => [state.blockListSettings]); /** - * Returns the parsed block saved as shared block with the given ID. - * - * @param {Object} state Global application state. - * @param {number|string} ref The shared block's ID. - * - * @return {Object} The parsed block. - */ - -const __experimentalGetParsedReusableBlock = Object(rememo["a" /* default */])((state, ref) => { - const reusableBlock = Object(external_lodash_["find"])(getReusableBlocks(state), block => block.id === ref); - - if (!reusableBlock) { - return null; - } // Only reusableBlock.content.raw should be used here, `reusableBlock.content` is a - // workaround until #22127 is fixed. - - - return Object(external_wp_blocks_["parse"])(typeof reusableBlock.content.raw === 'string' ? reusableBlock.content.raw : reusableBlock.content); -}, state => [getReusableBlocks(state)]); -/** * Returns the title of a given reusable block * * @param {Object} state Global application state. @@ -11051,10 +7620,10 @@ * @return {string} The reusable block saved title. */ -const selectors_experimentalGetReusableBlockTitle = Object(rememo["a" /* default */])((state, ref) => { +const __experimentalGetReusableBlockTitle = rememo((state, ref) => { var _reusableBlock$title; - const reusableBlock = Object(external_lodash_["find"])(getReusableBlocks(state), block => block.id === ref); + const reusableBlock = (0,external_lodash_namespaceObject.find)(getReusableBlocks(state), block => block.id === ref); if (!reusableBlock) { return null; @@ -11072,7 +7641,7 @@ * @return {boolean} Whether the most recent block change was ignored. */ -function selectors_unstableIsLastBlockChangeIgnored(state) { +function __unstableIsLastBlockChangeIgnored(state) { // TODO: Removal Plan: Changes incurred by RECEIVE_BLOCKS should not be // ignored if in-fact they result in a change in blocks state. The current // need to ignore changes not a result of user interaction should be @@ -11102,16 +7671,16 @@ */ function getReusableBlocks(state) { - var _state$settings$__exp, _state$settings; - - return (_state$settings$__exp = state === null || state === void 0 ? void 0 : (_state$settings = state.settings) === null || _state$settings === void 0 ? void 0 : _state$settings.__experimentalReusableBlocks) !== null && _state$settings$__exp !== void 0 ? _state$settings$__exp : EMPTY_ARRAY; + var _state$settings$__exp, _state$settings2; + + return (_state$settings$__exp = state === null || state === void 0 ? void 0 : (_state$settings2 = state.settings) === null || _state$settings2 === void 0 ? void 0 : _state$settings2.__experimentalReusableBlocks) !== null && _state$settings$__exp !== void 0 ? _state$settings$__exp : EMPTY_ARRAY; } /** * Returns whether the navigation mode is enabled. * * @param {Object} state Editor state. * - * @return {boolean} Is navigation mode enabled. + * @return {boolean} Is navigation mode enabled. */ @@ -11123,7 +7692,7 @@ * * @param {Object} state Editor state. * - * @return {string} Client Id of moving block. + * @return {string} Client Id of moving block. */ function selectors_hasBlockMovingClientId(state) { @@ -11137,25 +7706,25 @@ * @return {boolean} Whether the last change was automatic. */ -function selectors_didAutomaticChange(state) { +function didAutomaticChange(state) { return !!state.automaticChangeStatus; } /** * Returns true if the current highlighted block matches the block clientId. * - * @param {Object} state Global application state. + * @param {Object} state Global application state. * @param {string} clientId The block to check. * * @return {boolean} Whether the block is currently highlighted. */ -function selectors_isBlockHighlighted(state, clientId) { +function isBlockHighlighted(state, clientId) { return state.highlightedBlock === clientId; } /** * Checks if a given block has controlled inner blocks. * - * @param {Object} state Global application state. + * @param {Object} state Global application state. * @param {string} clientId The block to check. * * @return {boolean} True if the block has controlled inner blocks. @@ -11169,31 +7738,31 @@ * A block is 'active' if it (or a child) is the selected block. * Returns the first match moving up the DOM from the selected block. * - * @param {Object} state Global application state. + * @param {Object} state Global application state. * @param {string[]} validBlocksNames The names of block types to check for. * * @return {string} The matching block's clientId. */ -const __experimentalGetActiveBlockIdByBlockNames = Object(rememo["a" /* default */])((state, validBlockNames) => { +const __experimentalGetActiveBlockIdByBlockNames = rememo((state, validBlockNames) => { if (!validBlockNames.length) { return null; } // Check if selected block is a valid entity area. - const selectedBlockClientId = selectors_getSelectedBlockClientId(state); - - if (validBlockNames.includes(selectors_getBlockName(state, selectedBlockClientId))) { + const selectedBlockClientId = getSelectedBlockClientId(state); + + if (validBlockNames.includes(getBlockName(state, selectedBlockClientId))) { return selectedBlockClientId; } // Check if first selected block is a child of a valid entity area. - const multiSelectedBlockClientIds = selectors_getMultiSelectedBlockClientIds(state); + const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(state); const entityAreaParents = getBlockParentsByBlockName(state, selectedBlockClientId || multiSelectedBlockClientIds[0], validBlockNames); if (entityAreaParents) { // Last parent closest/most interior. - return Object(external_lodash_["last"])(entityAreaParents); + return (0,external_lodash_namespaceObject.last)(entityAreaParents); } return null; @@ -11201,9 +7770,9 @@ /** * Tells if the block with the passed clientId was just inserted. * - * @param {Object} state Global application state. - * @param {Object} clientId Client Id of the block. - * @param {?string} source Optional insertion source of the block. + * @param {Object} state Global application state. + * @param {Object} clientId Client Id of the block. + * @param {?string} source Optional insertion source of the block. * @return {boolean} True if the block matches the last block inserted from the specified source. */ @@ -11214,111 +7783,81 @@ return lastBlockInserted.clientId === clientId && lastBlockInserted.source === source; } -// EXTERNAL MODULE: external ["wp","a11y"] -var external_wp_a11y_ = __webpack_require__("gdqT"); - -// EXTERNAL MODULE: external ["wp","deprecated"] -var external_wp_deprecated_ = __webpack_require__("NMb1"); -var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/controls.js -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - -const __unstableMarkAutomaticChangeFinalControl = function () { - return { - type: 'MARK_AUTOMATIC_CHANGE_FINAL_CONTROL' - }; -}; -const controls_controls = { - SLEEP({ - duration - }) { - return new Promise(resolve => { - setTimeout(resolve, duration); - }); - }, - - MARK_AUTOMATIC_CHANGE_FINAL_CONTROL: Object(external_wp_data_["createRegistryControl"])(registry => () => { - const { - requestIdleCallback = callback => setTimeout(callback, 100) - } = window; - requestIdleCallback(() => registry.dispatch(store).__unstableMarkAutomaticChangeFinal()); - }) -}; -/* harmony default export */ var store_controls = (controls_controls); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/constants.js -const STORE_NAME = 'core/block-editor'; - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/actions.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - - -/** - * Internal dependencies - */ - - - -/** - * Generator which will yield a default block insert action if there - * are no other blocks at the root of the editor. This generator should be used +;// CONCATENATED MODULE: external ["wp","a11y"] +var external_wp_a11y_namespaceObject = window["wp"]["a11y"]; +;// CONCATENATED MODULE: external ["wp","deprecated"] +var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; +var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/actions.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + +/** + * Action which will insert a default block insert action if there + * are no other blocks at the root of the editor. This action should be used * in actions which may result in no blocks remaining in the editor (removal, * replacement, etc). */ -function* ensureDefaultBlock() { - const count = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockCount'); // To avoid a focus loss when removing the last block, assure there is +const ensureDefaultBlock = () => _ref => { + let { + select, + dispatch + } = _ref; + // To avoid a focus loss when removing the last block, assure there is // always a default block if the last of the blocks have been removed. - - if (count === 0) { - const { - __unstableHasCustomAppender - } = yield external_wp_data_["controls"].select(STORE_NAME, 'getSettings'); // If there's an custom appender, don't insert default block. - // We have to remember to manually move the focus elsewhere to - // prevent it from being lost though. - - if (__unstableHasCustomAppender) { - return; - } - - return yield actions_insertDefaultBlock(); - } -} -/** - * 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. + const count = select.getBlockCount(); + + if (count > 0) { + return; + } // If there's an custom appender, don't insert default block. + // We have to remember to manually move the focus elsewhere to + // prevent it from being lost though. + + + const { + __unstableHasCustomAppender + } = select.getSettings(); + + if (__unstableHasCustomAppender) { + return; + } + + dispatch.insertDefaultBlock(); +}; +/** + * Action that resets blocks state to the specified array of blocks, taking precedence + * over any other content reflected as an edit in state. * * @param {Array} blocks Array of blocks. */ -function* actions_resetBlocks(blocks) { - yield { +const resetBlocks = blocks => _ref2 => { + let { + dispatch + } = _ref2; + dispatch({ type: 'RESET_BLOCKS', blocks - }; - return yield* validateBlocksToTemplate(blocks); -} + }); + dispatch(validateBlocksToTemplate(blocks)); +}; /** * Block validity is a function of blocks state (at the point of a * reset) and the template setting. As a compromise to its placement @@ -11328,20 +7867,24 @@ * @param {Array} blocks Array of blocks. */ -function* validateBlocksToTemplate(blocks) { - const template = yield external_wp_data_["controls"].select(STORE_NAME, 'getTemplate'); - const templateLock = yield external_wp_data_["controls"].select(STORE_NAME, 'getTemplateLock'); // Unlocked templates are considered always valid because they act +const validateBlocksToTemplate = blocks => _ref3 => { + let { + select, + dispatch + } = _ref3; + const template = select.getTemplate(); + const templateLock = select.getTemplateLock(); // Unlocked templates are considered always valid because they act // as default values only. - const isBlocksValidToTemplate = !template || templateLock !== 'all' || Object(external_wp_blocks_["doBlocksMatchTemplate"])(blocks, template); // Update if validity has changed. - - const isValidTemplate = yield external_wp_data_["controls"].select(STORE_NAME, 'isValidTemplate'); + const isBlocksValidToTemplate = !template || templateLock !== 'all' || (0,external_wp_blocks_namespaceObject.doBlocksMatchTemplate)(blocks, template); // Update if validity has changed. + + const isValidTemplate = select.isValidTemplate(); if (isBlocksValidToTemplate !== isValidTemplate) { - yield setTemplateValidity(isBlocksValidToTemplate); + dispatch.setTemplateValidity(isBlocksValidToTemplate); return isBlocksValidToTemplate; } -} +}; /** * A block selection object. * @@ -11354,6 +7897,17 @@ */ /** + * A selection object. + * + * @typedef {Object} WPSelection + * + * @property {WPBlockSelection} start The selection start. + * @property {WPBlockSelection} end The selection end. + */ + +/* eslint-disable jsdoc/valid-types */ + +/** * Returns an action object used in signalling that selection state should be * reset to the specified selection. * @@ -11364,7 +7918,8 @@ * @return {Object} Action object. */ -function actions_resetSelection(selectionStart, selectionEnd, initialPosition) { +function resetSelection(selectionStart, selectionEnd, initialPosition) { + /* eslint-enable jsdoc/valid-types */ return { type: 'RESET_SELECTION', selectionStart, @@ -11377,39 +7932,44 @@ * Unlike resetBlocks, these should be appended to the existing known set, not * replacing. * + * @deprecated + * * @param {Object[]} blocks Array of block objects. * * @return {Object} Action object. */ function receiveBlocks(blocks) { + external_wp_deprecated_default()('wp.data.dispatch( "core/block-editor" ).receiveBlocks', { + since: '5.9', + alternative: 'resetBlocks or insertBlocks' + }); return { type: 'RECEIVE_BLOCKS', blocks }; } /** - * Returns an action object used in signalling that the multiple blocks' - * attributes with the specified client IDs have been updated. - * - * @param {string|string[]} clientIds Block client IDs. - * @param {Object} attributes Block attributes to be merged. Should be keyed by clientIds if - * uniqueByBlock is true. - * @param {boolean} uniqueByBlock true if each block in clientIds array has a unique set of attributes + * Action that updates attributes of multiple blocks with the specified client IDs. + * + * @param {string|string[]} clientIds Block client IDs. + * @param {Object} attributes Block attributes to be merged. Should be keyed by clientIds if + * uniqueByBlock is true. + * @param {boolean} uniqueByBlock true if each block in clientIds array has a unique set of attributes * @return {Object} Action object. */ -function actions_updateBlockAttributes(clientIds, attributes, uniqueByBlock = false) { +function updateBlockAttributes(clientIds, attributes) { + let uniqueByBlock = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; return { type: 'UPDATE_BLOCK_ATTRIBUTES', - clientIds: Object(external_lodash_["castArray"])(clientIds), + clientIds: (0,external_lodash_namespaceObject.castArray)(clientIds), attributes, uniqueByBlock }; } /** - * Returns an action object used in signalling that the block with the - * specified client ID has been updated. + * Action that updates the block with the specified client ID. * * @param {string} clientId Block client ID. * @param {Object} updates Block attributes to be merged. @@ -11417,13 +7977,15 @@ * @return {Object} Action object. */ -function actions_updateBlock(clientId, updates) { +function updateBlock(clientId, updates) { return { type: 'UPDATE_BLOCK', clientId, updates }; } +/* eslint-disable jsdoc/valid-types */ + /** * Returns an action object used in signalling that the block with the * specified client ID has been selected, optionally accepting a position @@ -11432,12 +7994,15 @@ * * @param {string} clientId Block client ID. * @param {0|-1|null} initialPosition Optional initial position. Pass as -1 to - * reflect reverse selection. + * reflect reverse selection. * * @return {Object} Action object. */ -function actions_selectBlock(clientId, initialPosition = 0) { +function selectBlock(clientId) { + let initialPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + + /* eslint-enable jsdoc/valid-types */ return { type: 'SELECT_BLOCK', initialPosition, @@ -11451,14 +8016,17 @@ * @param {string} clientId Block client ID. */ -function* selectPreviousBlock(clientId) { - const previousBlockClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getPreviousBlockClientId', clientId); +const selectPreviousBlock = clientId => _ref4 => { + let { + select, + dispatch + } = _ref4; + const previousBlockClientId = select.getPreviousBlockClientId(clientId); if (previousBlockClientId) { - yield actions_selectBlock(previousBlockClientId, -1); - return [previousBlockClientId]; - } -} + dispatch.selectBlock(previousBlockClientId, -1); + } +}; /** * Yields action objects used in signalling that the block following the given * clientId should be selected. @@ -11466,74 +8034,87 @@ * @param {string} clientId Block client ID. */ -function* selectNextBlock(clientId) { - const nextBlockClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getNextBlockClientId', clientId); +const selectNextBlock = clientId => _ref5 => { + let { + select, + dispatch + } = _ref5; + const nextBlockClientId = select.getNextBlockClientId(clientId); if (nextBlockClientId) { - yield actions_selectBlock(nextBlockClientId); - return [nextBlockClientId]; - } -} -/** - * Returns an action object used in signalling that a block multi-selection has started. + dispatch.selectBlock(nextBlockClientId); + } +}; +/** + * Action that starts block multi-selection. * * @return {Object} Action object. */ -function actions_startMultiSelect() { +function startMultiSelect() { return { type: 'START_MULTI_SELECT' }; } /** - * Returns an action object used in signalling that block multi-selection stopped. + * Action that stops block multi-selection. * * @return {Object} Action object. */ -function actions_stopMultiSelect() { +function stopMultiSelect() { return { type: 'STOP_MULTI_SELECT' }; } /** - * Returns an action object used in signalling that block multi-selection changed. - * - * @param {string} start First block of the multi selection. - * @param {string} end Last block of the multiselection. - */ - -function* actions_multiSelect(start, end) { - const startBlockRootClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockRootClientId', start); - const endBlockRootClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockRootClientId', end); // Only allow block multi-selections at the same level. - - if (startBlockRootClientId !== endBlockRootClientId) { - return; - } - - yield { - type: 'MULTI_SELECT', - start, - end - }; - const blockCount = yield external_wp_data_["controls"].select(STORE_NAME, 'getSelectedBlockCount'); - Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["sprintf"])( - /* translators: %s: number of selected blocks */ - Object(external_wp_i18n_["_n"])('%s block selected.', '%s blocks selected.', blockCount), blockCount), 'assertive'); -} -/** - * Returns an action object used in signalling that the block selection is cleared. + * Action that changes block multi-selection. + * + * @param {string} start First block of the multi selection. + * @param {string} end Last block of the multiselection. + * @param {number|null} __experimentalInitialPosition Optional initial position. Pass as null to skip focus within editor canvas. + */ + +const multiSelect = function (start, end) { + let __experimentalInitialPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + + return _ref6 => { + let { + select, + dispatch + } = _ref6; + const startBlockRootClientId = select.getBlockRootClientId(start); + const endBlockRootClientId = select.getBlockRootClientId(end); // Only allow block multi-selections at the same level. + + if (startBlockRootClientId !== endBlockRootClientId) { + return; + } + + dispatch({ + type: 'MULTI_SELECT', + start, + end, + initialPosition: __experimentalInitialPosition + }); + const blockCount = select.getSelectedBlockCount(); + (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %s: number of selected blocks */ + (0,external_wp_i18n_namespaceObject._n)('%s block selected.', '%s blocks selected.', blockCount), blockCount), 'assertive'); + }; +}; +/** + * Action that clears the block selection. * * @return {Object} Action object. */ -function actions_clearSelectedBlock() { +function clearSelectedBlock() { return { type: 'CLEAR_SELECTED_BLOCK' }; } /** - * Returns an action object that enables or disables block selection. + * Action that enables or disables block selection. * * @param {boolean} [isSelectionEnabled=true] Whether block selection should * be enabled. @@ -11541,7 +8122,8 @@ * @return {Object} Action object. */ -function actions_toggleSelection(isSelectionEnabled = true) { +function toggleSelection() { + let isSelectionEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; return { type: 'TOGGLE_SELECTION', isSelectionEnabled @@ -11557,7 +8139,7 @@ const blockName = block.name; - if (!Object(external_wp_blocks_["hasBlockSupport"])(blockName, 'defaultStylePicker', true)) { + if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'defaultStylePicker', true)) { return block; } @@ -11582,9 +8164,10 @@ }; }); } -/** - * Returns an action object signalling that a blocks should be replaced with - * one or more replacement blocks. +/* eslint-disable jsdoc/valid-types */ + +/** + * Action that replaces given blocks with one or more replacement blocks. * * @param {(string|string[])} clientIds Block client ID(s) to replace. * @param {(Object|Object[])} blocks Replacement block(s). @@ -11592,38 +8175,47 @@ * @param {0|-1|null} initialPosition Index of caret after in the selected block after the operation. * @param {?Object} meta Optional Meta values to be passed to the action object. * - * @yield {Object} Action object. - */ - - -function* actions_replaceBlocks(clientIds, blocks, indexToSelect, initialPosition = 0, meta) { - clientIds = Object(external_lodash_["castArray"])(clientIds); - blocks = getBlocksWithDefaultStylesApplied(Object(external_lodash_["castArray"])(blocks), yield external_wp_data_["controls"].select(STORE_NAME, 'getSettings')); - const rootClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockRootClientId', Object(external_lodash_["first"])(clientIds)); // Replace is valid if the new blocks can be inserted in the root block. - - for (let index = 0; index < blocks.length; index++) { - const block = blocks[index]; - const canInsertBlock = yield external_wp_data_["controls"].select(STORE_NAME, 'canInsertBlockType', block.name, rootClientId); - - if (!canInsertBlock) { - return; - } - } - - yield { - type: 'REPLACE_BLOCKS', - clientIds, - blocks, - time: Date.now(), - indexToSelect, - initialPosition, - meta - }; - yield* ensureDefaultBlock(); -} -/** - * Returns an action object signalling that a single block should be replaced - * with one or more replacement blocks. + * @return {Object} Action object. + */ + + +const replaceBlocks = function (clientIds, blocks, indexToSelect) { + let initialPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + let meta = arguments.length > 4 ? arguments[4] : undefined; + return _ref7 => { + let { + select, + dispatch + } = _ref7; + + /* eslint-enable jsdoc/valid-types */ + clientIds = (0,external_lodash_namespaceObject.castArray)(clientIds); + blocks = getBlocksWithDefaultStylesApplied((0,external_lodash_namespaceObject.castArray)(blocks), select.getSettings()); + const rootClientId = select.getBlockRootClientId((0,external_lodash_namespaceObject.first)(clientIds)); // Replace is valid if the new blocks can be inserted in the root block. + + for (let index = 0; index < blocks.length; index++) { + const block = blocks[index]; + const canInsertBlock = select.canInsertBlockType(block.name, rootClientId); + + if (!canInsertBlock) { + return; + } + } + + dispatch({ + type: 'REPLACE_BLOCKS', + clientIds, + blocks, + time: Date.now(), + indexToSelect, + initialPosition, + meta + }); + dispatch(ensureDefaultBlock()); + }; +}; +/** + * Action that replaces a single block with one or more replacement blocks. * * @param {(string|string[])} clientId Block client ID to replace. * @param {(Object|Object[])} block Replacement block(s). @@ -11631,8 +8223,8 @@ * @return {Object} Action object. */ -function actions_replaceBlock(clientId, block) { - return actions_replaceBlocks(clientId, block); +function replaceBlock(clientId, block) { + return replaceBlocks(clientId, block); } /** * Higher-order action creator which, given the action type to dispatch creates @@ -11643,98 +8235,110 @@ * @return {Function} Action creator. */ -function createOnMove(type) { - return (clientIds, rootClientId) => { - return { - clientIds: Object(external_lodash_["castArray"])(clientIds), - type, - rootClientId - }; - }; -} - -const actions_moveBlocksDown = createOnMove('MOVE_BLOCKS_DOWN'); -const actions_moveBlocksUp = createOnMove('MOVE_BLOCKS_UP'); -/** - * Returns an action object signalling that the given blocks should be moved to - * a new position. - * - * @param {?string} clientIds The client IDs of the blocks. - * @param {?string} fromRootClientId Root client ID source. - * @param {?string} toRootClientId Root client ID destination. - * @param {number} index The index to move the blocks to. - * - * @yield {Object} Action object. - */ - -function* actions_moveBlocksToPosition(clientIds, fromRootClientId = '', toRootClientId = '', index) { - const templateLock = yield external_wp_data_["controls"].select(STORE_NAME, 'getTemplateLock', fromRootClientId); // If locking is equal to all on the original clientId (fromRootClientId), - // it is not possible to move the block to any other position. - - if (templateLock === 'all') { +const createOnMove = type => (clientIds, rootClientId) => _ref8 => { + let { + select, + dispatch + } = _ref8; + // If one of the blocks is locked or the parent is locked, we cannot move any block. + const canMoveBlocks = select.canMoveBlocks(clientIds, rootClientId); + + if (!canMoveBlocks) { return; } - const action = { - type: 'MOVE_BLOCKS_TO_POSITION', - fromRootClientId, - toRootClientId, - clientIds, - index - }; // If moving inside the same root block the move is always possible. - - if (fromRootClientId === toRootClientId) { - yield action; - return; - } // If templateLock is insert we can not remove the block from the parent. - // Given that here we know that we are moving the block to a different - // parent, the move should not be possible if the condition is true. - - - if (templateLock === 'insert') { - return; - } - - const canInsertBlocks = yield external_wp_data_["controls"].select(STORE_NAME, 'canInsertBlocks', clientIds, toRootClientId); // If moving to other parent block, the move is possible if we can insert a block of the same type inside the new parent block. - - if (canInsertBlocks) { - yield action; - } -} -/** - * Returns an action object signalling that the given block should be moved to a - * new position. - * - * @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 to. - * - * @yield {Object} Action object. - */ - -function* actions_moveBlockToPosition(clientId, fromRootClientId = '', toRootClientId = '', index) { - yield actions_moveBlocksToPosition([clientId], fromRootClientId, toRootClientId, 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. + dispatch({ + type, + clientIds: (0,external_lodash_namespaceObject.castArray)(clientIds), + rootClientId + }); +}; + +const moveBlocksDown = createOnMove('MOVE_BLOCKS_DOWN'); +const moveBlocksUp = createOnMove('MOVE_BLOCKS_UP'); +/** + * Action that moves given blocks to a new position. + * + * @param {?string} clientIds The client IDs of the blocks. + * @param {?string} fromRootClientId Root client ID source. + * @param {?string} toRootClientId Root client ID destination. + * @param {number} index The index to move the blocks to. + */ + +const moveBlocksToPosition = function (clientIds) { + let fromRootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + let toRootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; + let index = arguments.length > 3 ? arguments[3] : undefined; + return _ref9 => { + let { + select, + dispatch + } = _ref9; + const canMoveBlocks = select.canMoveBlocks(clientIds, fromRootClientId); // If one of the blocks is locked or the parent is locked, we cannot move any block. + + if (!canMoveBlocks) { + return; + } // If moving inside the same root block the move is always possible. + + + if (fromRootClientId !== toRootClientId) { + const canRemoveBlocks = select.canRemoveBlocks(clientIds, fromRootClientId); // If we're moving to another block, it means we're deleting blocks from + // the original block, so we need to check if removing is possible. + + if (!canRemoveBlocks) { + return; + } + + const canInsertBlocks = select.canInsertBlocks(clientIds, toRootClientId); // If moving to other parent block, the move is possible if we can insert a block of the same type inside the new parent block. + + if (!canInsertBlocks) { + return; + } + } + + dispatch({ + type: 'MOVE_BLOCKS_TO_POSITION', + fromRootClientId, + toRootClientId, + clientIds, + index + }); + }; +}; +/** + * Action that moves given block to a new position. + * + * @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 to. + */ + +function moveBlockToPosition(clientId) { + let fromRootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + let toRootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; + let index = arguments.length > 3 ? arguments[3] : undefined; + return moveBlocksToPosition([clientId], fromRootClientId, toRootClientId, index); +} +/** + * Action that inserts a single block, 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. - * @param {?Object} meta Optional Meta values to be passed to the action object. + * @param {?Object} meta Optional Meta values to be passed to the action object. * * @return {Object} Action object. */ -function actions_insertBlock(block, index, rootClientId, updateSelection = true, meta) { - return actions_insertBlocks([block], index, rootClientId, updateSelection, 0, meta); -} -/** - * 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. +function insertBlock(block, index, rootClientId, updateSelection, meta) { + return insertBlocks([block], index, rootClientId, updateSelection, 0, meta); +} +/* eslint-disable jsdoc/valid-types */ + +/** + * Action that inserts an array of blocks, 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. @@ -11745,54 +8349,65 @@ * @return {Object} Action object. */ -function* actions_insertBlocks(blocks, index, rootClientId, updateSelection = true, initialPosition = 0, meta) { - if (Object(external_lodash_["isObject"])(initialPosition)) { - meta = initialPosition; - initialPosition = 0; - external_wp_deprecated_default()("meta argument in wp.data.dispatch('core/block-editor')", { - since: '10.1', - plugin: 'Gutenberg', - hint: 'The meta argument is now the 6th argument of the function' - }); - } - - blocks = getBlocksWithDefaultStylesApplied(Object(external_lodash_["castArray"])(blocks), yield external_wp_data_["controls"].select(STORE_NAME, 'getSettings')); - const allowedBlocks = []; - - for (const block of blocks) { - const isValid = yield external_wp_data_["controls"].select(STORE_NAME, 'canInsertBlockType', block.name, rootClientId); - - if (isValid) { - allowedBlocks.push(block); - } - } - - if (allowedBlocks.length) { - return { - type: 'INSERT_BLOCKS', - blocks: allowedBlocks, - index, - rootClientId, - time: Date.now(), - updateSelection, - initialPosition: updateSelection ? initialPosition : null, - meta - }; - } -} -/** - * 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. - * @param {Object} __unstableOptions Wether or not to show an inserter button. +const insertBlocks = function (blocks, index, rootClientId) { + let updateSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + let initialPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; + let meta = arguments.length > 5 ? arguments[5] : undefined; + return _ref10 => { + let { + select, + dispatch + } = _ref10; + + /* eslint-enable jsdoc/valid-types */ + if ((0,external_lodash_namespaceObject.isObject)(initialPosition)) { + meta = initialPosition; + initialPosition = 0; + external_wp_deprecated_default()("meta argument in wp.data.dispatch('core/block-editor')", { + since: '5.8', + hint: 'The meta argument is now the 6th argument of the function' + }); + } + + blocks = getBlocksWithDefaultStylesApplied((0,external_lodash_namespaceObject.castArray)(blocks), select.getSettings()); + const allowedBlocks = []; + + for (const block of blocks) { + const isValid = select.canInsertBlockType(block.name, rootClientId); + + if (isValid) { + allowedBlocks.push(block); + } + } + + if (allowedBlocks.length) { + dispatch({ + type: 'INSERT_BLOCKS', + blocks: allowedBlocks, + index, + rootClientId, + time: Date.now(), + updateSelection, + initialPosition: updateSelection ? initialPosition : null, + meta + }); + } + }; +}; +/** + * Action that shows the insertion point. + * + * @param {?string} rootClientId Optional root client ID of block list on + * which to insert. + * @param {?number} index Index at which block should be inserted. + * @param {Object} __unstableOptions Whether or not to show an inserter button. * * @return {Object} Action object. */ -function actions_showInsertionPoint(rootClientId, index, __unstableOptions = {}) { +function showInsertionPoint(rootClientId, index) { + let __unstableOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + const { __unstableWithInserter } = __unstableOptions; @@ -11804,20 +8419,20 @@ }; } /** - * Returns an action object hiding the insertion point. + * Action that hides the insertion point. * * @return {Object} Action object. */ -function actions_hideInsertionPoint() { +function hideInsertionPoint() { return { type: 'HIDE_INSERTION_POINT' }; } /** - * Returns an action object resetting the template validity. - * - * @param {boolean} isValid template validity flag. + * Action that resets the template validity. + * + * @param {boolean} isValid template validity flag. * * @return {Object} Action object. */ @@ -11829,49 +8444,280 @@ }; } /** - * Returns an action object synchronize the template with the list of blocks + * Action that synchronizes the template with the list of blocks. * * @return {Object} Action object. */ -function* synchronizeTemplate() { - yield { +const synchronizeTemplate = () => _ref11 => { + let { + select, + dispatch + } = _ref11; + dispatch({ type: 'SYNCHRONIZE_TEMPLATE' - }; - const blocks = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlocks'); - const template = yield external_wp_data_["controls"].select(STORE_NAME, 'getTemplate'); - const updatedBlockList = Object(external_wp_blocks_["synchronizeBlocksWithTemplate"])(blocks, template); - return yield actions_resetBlocks(updatedBlockList); -} -/** - * Returns an action object used in signalling that two blocks should be merged + }); + const blocks = select.getBlocks(); + const template = select.getTemplate(); + const updatedBlockList = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(blocks, template); + dispatch.resetBlocks(updatedBlockList); +}; +/** + * Delete the current selection. + * + * @param {boolean} isForward + */ + +const __unstableDeleteSelection = isForward => _ref12 => { + let { + registry, + select, + dispatch + } = _ref12; + const selectionAnchor = select.getSelectionStart(); + const selectionFocus = select.getSelectionEnd(); + if (selectionAnchor.clientId === selectionFocus.clientId) return; // It's not mergeable if there's no rich text selection. + + if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') return false; + const anchorRootClientId = select.getBlockRootClientId(selectionAnchor.clientId); + const focusRootClientId = select.getBlockRootClientId(selectionFocus.clientId); // It's not mergeable if the selection doesn't start and end in the same + // block list. Maybe in the future it should be allowed. + + if (anchorRootClientId !== focusRootClientId) { + return; + } + + const blockOrder = select.getBlockOrder(anchorRootClientId); + const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId); + const focusIndex = blockOrder.indexOf(selectionFocus.clientId); // Reassign selection start and end based on order. + + let selectionStart, selectionEnd; + + if (anchorIndex > focusIndex) { + selectionStart = selectionFocus; + selectionEnd = selectionAnchor; + } else { + selectionStart = selectionAnchor; + selectionEnd = selectionFocus; + } + + const targetSelection = isForward ? selectionEnd : selectionStart; + const targetBlock = select.getBlock(targetSelection.clientId); + const targetBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(targetBlock.name); + + if (!targetBlockType.merge) { + return; + } + + const selectionA = selectionStart; + const selectionB = selectionEnd; + const blockA = select.getBlock(selectionA.clientId); + const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name); + const blockB = select.getBlock(selectionB.clientId); + const blockBType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockB.name); + const htmlA = blockA.attributes[selectionA.attributeKey]; + const htmlB = blockB.attributes[selectionB.attributeKey]; + const attributeDefinitionA = blockAType.attributes[selectionA.attributeKey]; + const attributeDefinitionB = blockBType.attributes[selectionB.attributeKey]; + let valueA = (0,external_wp_richText_namespaceObject.create)({ + html: htmlA, + ...mapRichTextSettings(attributeDefinitionA) + }); + let valueB = (0,external_wp_richText_namespaceObject.create)({ + html: htmlB, + ...mapRichTextSettings(attributeDefinitionB) + }); // A robust way to retain selection position through various transforms + // is to insert a special character at the position and then recover it. + + const START_OF_SELECTED_AREA = '\u0086'; + valueA = (0,external_wp_richText_namespaceObject.remove)(valueA, selectionA.offset, valueA.text.length); + valueB = (0,external_wp_richText_namespaceObject.insert)(valueB, START_OF_SELECTED_AREA, 0, selectionB.offset); // Clone the blocks so we don't manipulate the original. + + const cloneA = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockA, { + [selectionA.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ + value: valueA, + ...mapRichTextSettings(attributeDefinitionA) + }) + }); + const cloneB = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockB, { + [selectionB.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ + value: valueB, + ...mapRichTextSettings(attributeDefinitionB) + }) + }); + const followingBlock = isForward ? cloneA : cloneB; // We can only merge blocks with similar types + // thus, we transform the block to merge first + + const blocksWithTheSameType = blockA.name === blockB.name ? [followingBlock] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(followingBlock, targetBlockType.name); // If the block types can not match, do nothing + + if (!blocksWithTheSameType || !blocksWithTheSameType.length) { + return; + } + + let updatedAttributes; + + if (isForward) { + const blockToMerge = blocksWithTheSameType.pop(); + updatedAttributes = targetBlockType.merge(blockToMerge.attributes, cloneB.attributes); + } else { + const blockToMerge = blocksWithTheSameType.shift(); + updatedAttributes = targetBlockType.merge(cloneA.attributes, blockToMerge.attributes); + } + + const newAttributeKey = (0,external_lodash_namespaceObject.findKey)(updatedAttributes, v => typeof v === 'string' && v.indexOf(START_OF_SELECTED_AREA) !== -1); + const convertedHtml = updatedAttributes[newAttributeKey]; + const convertedValue = (0,external_wp_richText_namespaceObject.create)({ + html: convertedHtml, + ...mapRichTextSettings(targetBlockType.attributes[newAttributeKey]) + }); + const newOffset = convertedValue.text.indexOf(START_OF_SELECTED_AREA); + const newValue = (0,external_wp_richText_namespaceObject.remove)(convertedValue, newOffset, newOffset + 1); + const newHtml = (0,external_wp_richText_namespaceObject.toHTMLString)({ + value: newValue, + ...mapRichTextSettings(targetBlockType.attributes[newAttributeKey]) + }); + updatedAttributes[newAttributeKey] = newHtml; + const selectedBlockClientIds = select.getSelectedBlockClientIds(); + const replacement = [...(isForward ? blocksWithTheSameType : []), { // Preserve the original client ID. + ...targetBlock, + attributes: { ...targetBlock.attributes, + ...updatedAttributes + } + }, ...(isForward ? [] : blocksWithTheSameType)]; + registry.batch(() => { + dispatch.selectionChange(targetBlock.clientId, newAttributeKey, newOffset, newOffset); + dispatch.replaceBlocks(selectedBlockClientIds, replacement, 0, // If we don't pass the `indexToSelect` it will default to the last block. + select.getSelectedBlocksInitialCaretPosition()); + }); +}; +/** + * Split the current selection. + */ + +const __unstableSplitSelection = () => _ref13 => { + let { + select, + dispatch + } = _ref13; + const selectionAnchor = select.getSelectionStart(); + const selectionFocus = select.getSelectionEnd(); + if (selectionAnchor.clientId === selectionFocus.clientId) return; // Can't split if the selection is not set. + + if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') return; + const anchorRootClientId = select.getBlockRootClientId(selectionAnchor.clientId); + const focusRootClientId = select.getBlockRootClientId(selectionFocus.clientId); // It's not splittable if the selection doesn't start and end in the same + // block list. Maybe in the future it should be allowed. + + if (anchorRootClientId !== focusRootClientId) { + return; + } + + const blockOrder = select.getBlockOrder(anchorRootClientId); + const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId); + const focusIndex = blockOrder.indexOf(selectionFocus.clientId); // Reassign selection start and end based on order. + + let selectionStart, selectionEnd; + + if (anchorIndex > focusIndex) { + selectionStart = selectionFocus; + selectionEnd = selectionAnchor; + } else { + selectionStart = selectionAnchor; + selectionEnd = selectionFocus; + } + + const selectionA = selectionStart; + const selectionB = selectionEnd; + const blockA = select.getBlock(selectionA.clientId); + const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name); + const blockB = select.getBlock(selectionB.clientId); + const blockBType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockB.name); + const htmlA = blockA.attributes[selectionA.attributeKey]; + const htmlB = blockB.attributes[selectionB.attributeKey]; + const attributeDefinitionA = blockAType.attributes[selectionA.attributeKey]; + const attributeDefinitionB = blockBType.attributes[selectionB.attributeKey]; + let valueA = (0,external_wp_richText_namespaceObject.create)({ + html: htmlA, + ...mapRichTextSettings(attributeDefinitionA) + }); + let valueB = (0,external_wp_richText_namespaceObject.create)({ + html: htmlB, + ...mapRichTextSettings(attributeDefinitionB) + }); + valueA = (0,external_wp_richText_namespaceObject.remove)(valueA, selectionA.offset, valueA.text.length); + valueB = (0,external_wp_richText_namespaceObject.remove)(valueB, 0, selectionB.offset); + dispatch.replaceBlocks(select.getSelectedBlockClientIds(), [{ // Preserve the original client ID. + ...blockA, + attributes: { ...blockA.attributes, + [selectionA.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ + value: valueA, + ...mapRichTextSettings(attributeDefinitionA) + }) + } + }, (0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)()), { // Preserve the original client ID. + ...blockB, + attributes: { ...blockB.attributes, + [selectionB.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ + value: valueB, + ...mapRichTextSettings(attributeDefinitionB) + }) + } + }], 1, // If we don't pass the `indexToSelect` it will default to the last block. + select.getSelectedBlocksInitialCaretPosition()); +}; +/** + * Expand the selection to cover the entire blocks, removing partial selection. + */ + +const __unstableExpandSelection = () => _ref14 => { + let { + select, + dispatch + } = _ref14; + const selectionAnchor = select.getSelectionStart(); + const selectionFocus = select.getSelectionEnd(); + dispatch.selectionChange({ + start: { + clientId: selectionAnchor.clientId + }, + end: { + clientId: selectionFocus.clientId + } + }); +}; +/** + * Action that merges two blocks. * * @param {string} firstBlockClientId Client ID of the first block to merge. * @param {string} secondBlockClientId Client ID of the second block to merge. */ -function* actions_mergeBlocks(firstBlockClientId, secondBlockClientId) { +const mergeBlocks = (firstBlockClientId, secondBlockClientId) => _ref15 => { + let { + select, + dispatch + } = _ref15; const blocks = [firstBlockClientId, secondBlockClientId]; - yield { + dispatch({ type: 'MERGE_BLOCKS', blocks - }; + }); const [clientIdA, clientIdB] = blocks; - const blockA = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlock', clientIdA); - const blockAType = Object(external_wp_blocks_["getBlockType"])(blockA.name); // Only focus the previous block if it's not mergeable - - if (!blockAType.merge) { - yield actions_selectBlock(blockA.clientId); + const blockA = select.getBlock(clientIdA); + const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name); // Only focus the previous block if it's not mergeable. + + if (blockAType && !blockAType.merge) { + dispatch.selectBlock(blockA.clientId); return; } - const blockB = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlock', clientIdB); - const blockBType = Object(external_wp_blocks_["getBlockType"])(blockB.name); + const blockB = select.getBlock(clientIdB); + const blockBType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockB.name); const { clientId, attributeKey, offset - } = yield external_wp_data_["controls"].select(STORE_NAME, 'getSelectionStart'); + } = select.getSelectionStart(); const selectedBlockType = clientId === clientIdA ? blockAType : blockBType; const attributeDefinition = selectedBlockType.attributes[attributeKey]; const canRestoreTextSelection = (clientId === clientIdA || clientId === clientIdB) && attributeKey !== undefined && offset !== undefined && // We cannot restore text selection if the RichText identifier @@ -11892,72 +8738,57 @@ const START_OF_SELECTED_AREA = '\u0086'; // Clone the blocks so we don't insert the character in a "live" block. - const cloneA = Object(external_wp_blocks_["cloneBlock"])(blockA); - const cloneB = Object(external_wp_blocks_["cloneBlock"])(blockB); + const cloneA = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockA); + const cloneB = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockB); if (canRestoreTextSelection) { const selectedBlock = clientId === clientIdA ? cloneA : cloneB; const html = selectedBlock.attributes[attributeKey]; - const { - multiline: multilineTag, - __unstableMultilineWrapperTags: multilineWrapperTags, - __unstablePreserveWhiteSpace: preserveWhiteSpace - } = attributeDefinition; - const value = Object(external_wp_richText_["insert"])(Object(external_wp_richText_["create"])({ + const value = (0,external_wp_richText_namespaceObject.insert)((0,external_wp_richText_namespaceObject.create)({ html, - multilineTag, - multilineWrapperTags, - preserveWhiteSpace + ...mapRichTextSettings(attributeDefinition) }), START_OF_SELECTED_AREA, offset, offset); - selectedBlock.attributes[attributeKey] = Object(external_wp_richText_["toHTMLString"])({ + selectedBlock.attributes[attributeKey] = (0,external_wp_richText_namespaceObject.toHTMLString)({ value, - multilineTag, - preserveWhiteSpace + ...mapRichTextSettings(attributeDefinition) }); } // We can only merge blocks with similar types - // thus, we transform the block to merge first - - - const blocksWithTheSameType = blockA.name === blockB.name ? [cloneB] : Object(external_wp_blocks_["switchToBlockType"])(cloneB, blockA.name); // If the block types can not match, do nothing + // thus, we transform the block to merge first. + + + const blocksWithTheSameType = blockA.name === blockB.name ? [cloneB] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(cloneB, blockA.name); // If the block types can not match, do nothing. if (!blocksWithTheSameType || !blocksWithTheSameType.length) { return; - } // Calling the merge to update the attributes and remove the block to be merged + } // Calling the merge to update the attributes and remove the block to be merged. const updatedAttributes = blockAType.merge(cloneA.attributes, blocksWithTheSameType[0].attributes); if (canRestoreTextSelection) { - const newAttributeKey = Object(external_lodash_["findKey"])(updatedAttributes, v => typeof v === 'string' && v.indexOf(START_OF_SELECTED_AREA) !== -1); + const newAttributeKey = (0,external_lodash_namespaceObject.findKey)(updatedAttributes, v => typeof v === 'string' && v.indexOf(START_OF_SELECTED_AREA) !== -1); const convertedHtml = updatedAttributes[newAttributeKey]; - const { - multiline: multilineTag, - __unstableMultilineWrapperTags: multilineWrapperTags, - __unstablePreserveWhiteSpace: preserveWhiteSpace - } = blockAType.attributes[newAttributeKey]; - const convertedValue = Object(external_wp_richText_["create"])({ + const convertedValue = (0,external_wp_richText_namespaceObject.create)({ html: convertedHtml, - multilineTag, - multilineWrapperTags, - preserveWhiteSpace + ...mapRichTextSettings(blockAType.attributes[newAttributeKey]) }); const newOffset = convertedValue.text.indexOf(START_OF_SELECTED_AREA); - const newValue = Object(external_wp_richText_["remove"])(convertedValue, newOffset, newOffset + 1); - const newHtml = Object(external_wp_richText_["toHTMLString"])({ + const newValue = (0,external_wp_richText_namespaceObject.remove)(convertedValue, newOffset, newOffset + 1); + const newHtml = (0,external_wp_richText_namespaceObject.toHTMLString)({ value: newValue, - multilineTag, - preserveWhiteSpace + ...mapRichTextSettings(blockAType.attributes[newAttributeKey]) }); updatedAttributes[newAttributeKey] = newHtml; - yield actions_selectionChange(blockA.clientId, newAttributeKey, newOffset, newOffset); - } - - yield* actions_replaceBlocks([blockA.clientId, blockB.clientId], [{ ...blockA, + dispatch.selectionChange(blockA.clientId, newAttributeKey, newOffset, newOffset); + } + + dispatch.replaceBlocks([blockA.clientId, blockB.clientId], [{ ...blockA, attributes: { ...blockA.attributes, ...updatedAttributes } - }, ...blocksWithTheSameType.slice(1)]); -} + }, ...blocksWithTheSameType.slice(1)], 0 // If we don't pass the `indexToSelect` it will default to the last block. + ); +}; /** * Yields action objects used in signalling that the blocks corresponding to * the set of specified client IDs are to be removed. @@ -11967,36 +8798,39 @@ * selected when a block is removed. */ -function* actions_removeBlocks(clientIds, selectPrevious = true) { - if (!clientIds || !clientIds.length) { - return; - } - - clientIds = Object(external_lodash_["castArray"])(clientIds); - const rootClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockRootClientId', clientIds[0]); - const isLocked = yield external_wp_data_["controls"].select(STORE_NAME, 'getTemplateLock', rootClientId); - - if (isLocked) { - return; - } - - let previousBlockId; - - if (selectPrevious) { - previousBlockId = yield selectPreviousBlock(clientIds[0]); - } else { - previousBlockId = yield external_wp_data_["controls"].select(STORE_NAME, 'getPreviousBlockClientId', clientIds[0]); - } - - yield { - type: 'REMOVE_BLOCKS', - clientIds - }; // To avoid a focus loss when removing the last block, assure there is - // always a default block if the last of the blocks have been removed. - - const defaultBlockId = yield* ensureDefaultBlock(); - return [previousBlockId || defaultBlockId]; -} +const removeBlocks = function (clientIds) { + let selectPrevious = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + return _ref16 => { + let { + select, + dispatch + } = _ref16; + + if (!clientIds || !clientIds.length) { + return; + } + + clientIds = (0,external_lodash_namespaceObject.castArray)(clientIds); + const rootClientId = select.getBlockRootClientId(clientIds[0]); + const canRemoveBlocks = select.canRemoveBlocks(clientIds, rootClientId); + + if (!canRemoveBlocks) { + return; + } + + if (selectPrevious) { + dispatch.selectPreviousBlock(clientIds[0]); + } + + dispatch({ + type: 'REMOVE_BLOCKS', + clientIds + }); // To avoid a focus loss when removing the last block, assure there is + // always a default block if the last of the blocks have been removed. + + dispatch(ensureDefaultBlock()); + }; +}; /** * Returns an action object used in signalling that the block with the * specified client ID is to be removed. @@ -12008,9 +8842,11 @@ * @return {Object} Action object. */ -function actions_removeBlock(clientId, selectPrevious) { - return actions_removeBlocks([clientId], selectPrevious); -} +function removeBlock(clientId, selectPrevious) { + return removeBlocks([clientId], selectPrevious); +} +/* eslint-disable jsdoc/valid-types */ + /** * Returns an action object used in signalling that the inner blocks with the * specified client ID should be replaced. @@ -12022,7 +8858,11 @@ * @return {Object} Action object. */ -function actions_replaceInnerBlocks(rootClientId, blocks, updateSelection = false, initialPosition = 0) { +function replaceInnerBlocks(rootClientId, blocks) { + let updateSelection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + let initialPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + + /* eslint-enable jsdoc/valid-types */ return { type: 'REPLACE_INNER_BLOCKS', rootClientId, @@ -12053,7 +8893,7 @@ * @return {Object} Action object. */ -function actions_startTyping() { +function startTyping() { return { type: 'START_TYPING' }; @@ -12064,7 +8904,7 @@ * @return {Object} Action object. */ -function actions_stopTyping() { +function stopTyping() { return { type: 'STOP_TYPING' }; @@ -12077,7 +8917,8 @@ * @return {Object} Action object. */ -function actions_startDraggingBlocks(clientIds = []) { +function startDraggingBlocks() { + let clientIds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; return { type: 'START_DRAGGING_BLOCKS', clientIds @@ -12089,7 +8930,7 @@ * @return {Object} Action object. */ -function actions_stopDraggingBlocks() { +function stopDraggingBlocks() { return { type: 'STOP_DRAGGING_BLOCKS' }; @@ -12100,7 +8941,7 @@ * @return {Object} Action object. */ -function actions_enterFormattedText() { +function enterFormattedText() { return { type: 'ENTER_FORMATTED_TEXT' }; @@ -12111,57 +8952,63 @@ * @return {Object} Action object. */ -function actions_exitFormattedText() { +function exitFormattedText() { return { type: 'EXIT_FORMATTED_TEXT' }; } /** - * Returns an action object used in signalling that the user caret has changed - * position. - * - * @param {string} clientId The selected block client ID. - * @param {string} attributeKey The selected block attribute key. - * @param {number} startOffset The start offset. - * @param {number} endOffset The end offset. + * Action that changes the position of the user caret. + * + * @param {string|WPSelection} clientId The selected block client ID. + * @param {string} attributeKey The selected block attribute key. + * @param {number} startOffset The start offset. + * @param {number} endOffset The end offset. * * @return {Object} Action object. */ -function actions_selectionChange(clientId, attributeKey, startOffset, endOffset) { +function selectionChange(clientId, attributeKey, startOffset, endOffset) { + if (typeof clientId === 'string') { + return { + type: 'SELECTION_CHANGE', + clientId, + attributeKey, + startOffset, + endOffset + }; + } + return { type: 'SELECTION_CHANGE', - clientId, - attributeKey, - startOffset, - endOffset - }; -} -/** - * Returns an action object used in signalling that a new block of the default - * type should be added to the block list. + ...clientId + }; +} +/** + * Action that adds a new block of the default type 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) { + * @param {?number} index Optional index where to insert the default block. + */ + +const insertDefaultBlock = (attributes, rootClientId, index) => _ref17 => { + let { + dispatch + } = _ref17; // Abort if there is no default block type (if it has been unregistered). - const defaultBlockName = Object(external_wp_blocks_["getDefaultBlockName"])(); + const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(); if (!defaultBlockName) { return; } - const block = Object(external_wp_blocks_["createBlock"])(defaultBlockName, attributes); - return actions_insertBlock(block, index, rootClientId); -} -/** - * Returns an action object that changes the nested settings of a given block. + const block = (0,external_wp_blocks_namespaceObject.createBlock)(defaultBlockName, attributes); + return dispatch.insertBlock(block, index, rootClientId); +}; +/** + * Action that changes the nested settings of a given block. * * @param {string} clientId Client ID of the block whose nested setting are * being received. @@ -12170,7 +9017,7 @@ * @return {Object} Action object */ -function actions_updateBlockListSettings(clientId, settings) { +function updateBlockListSettings(clientId, settings) { return { type: 'UPDATE_BLOCK_LIST_SETTINGS', clientId, @@ -12178,21 +9025,21 @@ }; } /** - * Returns an action object used in signalling that the block editor settings have been updated. + * Action that updates the block editor settings. * * @param {Object} settings Updated settings * * @return {Object} Action object */ -function actions_updateSettings(settings) { +function updateSettings(settings) { return { type: 'UPDATE_SETTINGS', settings }; } /** - * Returns an action object used in signalling that a temporary reusable blocks have been saved + * Action that signals that a temporary reusable block has been saved * in order to switch its temporary id with the real id. * * @param {string} id Reusable block's id. @@ -12209,166 +9056,202 @@ }; } /** - * Returns an action object used in signalling that the last block change should be marked explicitly as persistent. + * Action that marks the last block change explicitly as persistent. * * @return {Object} Action object. */ -function actions_unstableMarkLastChangeAsPersistent() { +function __unstableMarkLastChangeAsPersistent() { return { type: 'MARK_LAST_CHANGE_AS_PERSISTENT' }; } /** - * Returns an action object used in signalling that the next block change should be marked explicitly as not persistent. + * Action that signals that the next block change should be marked explicitly as not persistent. * * @return {Object} Action object. */ -function actions_unstableMarkNextChangeAsNotPersistent() { +function __unstableMarkNextChangeAsNotPersistent() { return { type: 'MARK_NEXT_CHANGE_AS_NOT_PERSISTENT' }; } /** - * Returns an action object used in signalling that the last block change is - * an automatic change, meaning it was not performed by the user, and can be - * undone using the `Escape` and `Backspace` keys. This action must be called - * after the change was made, and any actions that are a consequence of it, so - * it is recommended to be called at the next idle period to ensure all + * Action that marks the last block change as an automatic change, meaning it was not + * performed by the user, and can be undone using the `Escape` and `Backspace` keys. + * This action must be called after the change was made, and any actions that are a + * consequence of it, so it is recommended to be called at the next idle period to ensure all * selection changes have been recorded. */ -function* actions_unstableMarkAutomaticChange() { - yield { +const __unstableMarkAutomaticChange = () => _ref18 => { + let { + dispatch + } = _ref18; + dispatch({ type: 'MARK_AUTOMATIC_CHANGE' - }; - yield __unstableMarkAutomaticChangeFinalControl(); -} -function __unstableMarkAutomaticChangeFinal() { - return { - type: 'MARK_AUTOMATIC_CHANGE_FINAL' - }; -} -/** - * Generators that triggers an action used to enable or disable the navigation mode. + }); + const { + requestIdleCallback = cb => setTimeout(cb, 100) + } = window; + requestIdleCallback(() => { + dispatch({ + type: 'MARK_AUTOMATIC_CHANGE_FINAL' + }); + }); +}; +/** + * Action that enables or disables the navigation mode. * * @param {string} isNavigationMode Enable/Disable navigation mode. */ -function* actions_setNavigationMode(isNavigationMode = true) { - yield { - type: 'SET_NAVIGATION_MODE', - isNavigationMode - }; - - if (isNavigationMode) { - Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('You are currently in navigation mode. Navigate blocks using the Tab key and Arrow keys. Use Left and Right Arrow keys to move between nesting levels. To exit navigation mode and edit the selected block, press Enter.')); - } else { - Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('You are currently in edit mode. To return to the navigation mode, press Escape.')); - } -} -/** - * Generator that triggers an action used to enable or disable the block moving mode. +const setNavigationMode = function () { + let isNavigationMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + return _ref19 => { + let { + dispatch + } = _ref19; + dispatch({ + type: 'SET_NAVIGATION_MODE', + isNavigationMode + }); + + if (isNavigationMode) { + (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('You are currently in navigation mode. Navigate blocks using the Tab key and Arrow keys. Use Left and Right Arrow keys to move between nesting levels. To exit navigation mode and edit the selected block, press Enter.')); + } else { + (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('You are currently in edit mode. To return to the navigation mode, press Escape.')); + } + }; +}; +/** + * Action that enables or disables the block moving mode. * * @param {string|null} hasBlockMovingClientId Enable/Disable block moving mode. */ -function* actions_setBlockMovingClientId(hasBlockMovingClientId = null) { - yield { - type: 'SET_BLOCK_MOVING_MODE', - hasBlockMovingClientId - }; - - if (hasBlockMovingClientId) { - Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('Use the Tab key and Arrow keys to choose new block location. Use Left and Right Arrow keys to move between nesting levels. Once location is selected press Enter or Space to move the block.')); - } -} -/** - * Generator that triggers an action used to duplicate a list of blocks. +const setBlockMovingClientId = function () { + let hasBlockMovingClientId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + return _ref20 => { + let { + dispatch + } = _ref20; + dispatch({ + type: 'SET_BLOCK_MOVING_MODE', + hasBlockMovingClientId + }); + + if (hasBlockMovingClientId) { + (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Use the Tab key and Arrow keys to choose new block location. Use Left and Right Arrow keys to move between nesting levels. Once location is selected press Enter or Space to move the block.')); + } + }; +}; +/** + * Action that duplicates a list of blocks. * * @param {string[]} clientIds - * @param {boolean} updateSelection - */ - -function* actions_duplicateBlocks(clientIds, updateSelection = true) { - if (!clientIds && !clientIds.length) { - return; - } - - const blocks = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlocksByClientId', clientIds); - const rootClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockRootClientId', clientIds[0]); // Return early if blocks don't exist. - - if (Object(external_lodash_["some"])(blocks, block => !block)) { - return; - } - - const blockNames = blocks.map(block => block.name); // Return early if blocks don't support multiple usage. - - if (Object(external_lodash_["some"])(blockNames, blockName => !Object(external_wp_blocks_["hasBlockSupport"])(blockName, 'multiple', true))) { - return; - } - - const lastSelectedIndex = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockIndex', Object(external_lodash_["last"])(Object(external_lodash_["castArray"])(clientIds)), rootClientId); - const clonedBlocks = blocks.map(block => Object(external_wp_blocks_["__experimentalCloneSanitizedBlock"])(block)); - yield actions_insertBlocks(clonedBlocks, lastSelectedIndex + 1, rootClientId, updateSelection); - - if (clonedBlocks.length > 1 && updateSelection) { - yield actions_multiSelect(Object(external_lodash_["first"])(clonedBlocks).clientId, Object(external_lodash_["last"])(clonedBlocks).clientId); - } - - return clonedBlocks.map(block => block.clientId); -} -/** - * Generator used to insert an empty block after a given block. + * @param {boolean} updateSelection + */ + +const duplicateBlocks = function (clientIds) { + let updateSelection = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + return _ref21 => { + let { + select, + dispatch + } = _ref21; + + if (!clientIds || !clientIds.length) { + return; + } // Return early if blocks don't exist. + + + const blocks = select.getBlocksByClientId(clientIds); + + if ((0,external_lodash_namespaceObject.some)(blocks, block => !block)) { + return; + } // Return early if blocks don't support multiple usage. + + + const blockNames = blocks.map(block => block.name); + + if (blockNames.some(blockName => !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'multiple', true))) { + return; + } + + const rootClientId = select.getBlockRootClientId(clientIds[0]); + const lastSelectedIndex = select.getBlockIndex((0,external_lodash_namespaceObject.last)((0,external_lodash_namespaceObject.castArray)(clientIds))); + const clonedBlocks = blocks.map(block => (0,external_wp_blocks_namespaceObject.__experimentalCloneSanitizedBlock)(block)); + dispatch.insertBlocks(clonedBlocks, lastSelectedIndex + 1, rootClientId, updateSelection); + + if (clonedBlocks.length > 1 && updateSelection) { + dispatch.multiSelect((0,external_lodash_namespaceObject.first)(clonedBlocks).clientId, (0,external_lodash_namespaceObject.last)(clonedBlocks).clientId); + } + + return clonedBlocks.map(block => block.clientId); + }; +}; +/** + * Action that inserts an empty block before a given block. * * @param {string} clientId */ -function* actions_insertBeforeBlock(clientId) { +const insertBeforeBlock = clientId => _ref22 => { + let { + select, + dispatch + } = _ref22; + if (!clientId) { return; } - const rootClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockRootClientId', clientId); - const isLocked = yield external_wp_data_["controls"].select(STORE_NAME, 'getTemplateLock', rootClientId); + const rootClientId = select.getBlockRootClientId(clientId); + const isLocked = select.getTemplateLock(rootClientId); if (isLocked) { return; } - const firstSelectedIndex = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockIndex', clientId, rootClientId); - return yield actions_insertDefaultBlock({}, rootClientId, firstSelectedIndex); -} -/** - * Generator used to insert an empty block before a given block. + const firstSelectedIndex = select.getBlockIndex(clientId); + return dispatch.insertDefaultBlock({}, rootClientId, firstSelectedIndex); +}; +/** + * Action that inserts an empty block after a given block. * * @param {string} clientId */ -function* actions_insertAfterBlock(clientId) { +const insertAfterBlock = clientId => _ref23 => { + let { + select, + dispatch + } = _ref23; + if (!clientId) { return; } - const rootClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockRootClientId', clientId); - const isLocked = yield external_wp_data_["controls"].select(STORE_NAME, 'getTemplateLock', rootClientId); + const rootClientId = select.getBlockRootClientId(clientId); + const isLocked = select.getTemplateLock(rootClientId); if (isLocked) { return; } - const firstSelectedIndex = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockIndex', clientId, rootClientId); - return yield actions_insertDefaultBlock({}, rootClientId, firstSelectedIndex + 1); -} -/** - * Returns an action object that toggles the highlighted block state. - * - * @param {string} clientId The block's clientId. + const firstSelectedIndex = select.getBlockIndex(clientId); + return dispatch.insertDefaultBlock({}, rootClientId, firstSelectedIndex + 1); +}; +/** + * Action that toggles the highlighted block state. + * + * @param {string} clientId The block's clientId. * @param {boolean} isHighlighted The highlight state. */ -function actions_toggleBlockHighlight(clientId, isHighlighted) { +function toggleBlockHighlight(clientId, isHighlighted) { return { type: 'TOGGLE_BLOCK_HIGHLIGHT', clientId, @@ -12376,28 +9259,27 @@ }; } /** - * Yields action objects used in signalling that the block corresponding to the - * given clientId should appear to "flash" by rhythmically highlighting it. + * Action that "flashes" the block with a given `clientId` by rhythmically highlighting it. * * @param {string} clientId Target block client ID. */ -function* actions_flashBlock(clientId) { - yield actions_toggleBlockHighlight(clientId, true); - yield { - type: 'SLEEP', - duration: 150 - }; - yield actions_toggleBlockHighlight(clientId, false); -} -/** - * Returns an action object that sets whether the block has controlled innerblocks. - * - * @param {string} clientId The block's clientId. +const flashBlock = clientId => async _ref24 => { + let { + dispatch + } = _ref24; + dispatch(toggleBlockHighlight(clientId, true)); + await new Promise(resolve => setTimeout(resolve, 150)); + dispatch(toggleBlockHighlight(clientId, false)); +}; +/** + * Action that sets whether a block has controlled inner blocks. + * + * @param {string} clientId The block's clientId. * @param {boolean} hasControlledInnerBlocks True if the block's inner blocks are controlled. */ -function actions_setHasControlledInnerBlocks(clientId, hasControlledInnerBlocks) { +function setHasControlledInnerBlocks(clientId, hasControlledInnerBlocks) { return { type: 'SET_HAS_CONTROLLED_INNER_BLOCKS', hasControlledInnerBlocks, @@ -12405,15 +9287,17 @@ }; } -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/index.js -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/constants.js +const STORE_NAME = 'core/block-editor'; + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/index.js +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ @@ -12428,10 +9312,9 @@ */ const storeConfig = { - reducer: store_reducer, + reducer: reducer, selectors: selectors_namespaceObject, - actions: actions_namespaceObject, - controls: store_controls + actions: actions_namespaceObject }; /** * Store definition for the block editor namespace. @@ -12441,15 +9324,39 @@ * @type {Object} */ -const store = Object(external_wp_data_["createReduxStore"])(STORE_NAME, { ...storeConfig, +const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { ...storeConfig, persist: ['preferences'] }); // Ideally we'd use register instead of register stores. -Object(external_wp_data_["registerStore"])(STORE_NAME, { ...storeConfig, +(0,external_wp_data_namespaceObject.registerStore)(STORE_NAME, { ...storeConfig, persist: ['preferences'] }); -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-display-block-controls/index.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-edit/context.js +/** + * WordPress dependencies + */ + +const DEFAULT_BLOCK_EDIT_CONTEXT = { + name: '', + isSelected: false +}; +const Context = (0,external_wp_element_namespaceObject.createContext)(DEFAULT_BLOCK_EDIT_CONTEXT); +const { + Provider +} = Context; + +/** + * A hook that returns the block edit context. + * + * @return {Object} Block edit context + */ + +function useBlockEditContext() { + return (0,external_wp_element_namespaceObject.useContext)(Context); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-display-block-controls/index.js /** * WordPress dependencies */ @@ -12466,10 +9373,9 @@ clientId, name } = useBlockEditContext(); - const isFirstAndSameTypeMultiSelected = Object(external_wp_data_["useSelect"])(select => { - // Don't bother checking, see OR statement below. + return (0,external_wp_data_namespaceObject.useSelect)(select => { if (isSelected) { - return; + return true; } const { @@ -12478,96 +9384,124 @@ getMultiSelectedBlockClientIds } = select(store); - if (!isFirstMultiSelectedBlock(clientId)) { - return false; - } - - return getMultiSelectedBlockClientIds().every(id => getBlockName(id) === name); + if (isFirstMultiSelectedBlock(clientId)) { + return getMultiSelectedBlockClientIds().every(id => getBlockName(id) === name); + } + + return false; }, [clientId, isSelected, name]); - return isSelected || isFirstAndSameTypeMultiSelected; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/groups.js -/** - * WordPress dependencies - */ - -const BlockControlsDefault = Object(external_wp_components_["createSlotFill"])('BlockControls'); -const BlockControlsBlock = Object(external_wp_components_["createSlotFill"])('BlockControlsBlock'); -const BlockControlsInline = Object(external_wp_components_["createSlotFill"])('BlockFormatControls'); -const BlockControlsOther = Object(external_wp_components_["createSlotFill"])('BlockControlsOther'); -const groups = { - default: BlockControlsDefault, - block: BlockControlsBlock, - inline: BlockControlsInline, - other: BlockControlsOther -}; -/* harmony default export */ var block_controls_groups = (groups); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/fill.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - - -function BlockControlsFill({ - group = 'default', - controls, - children -}) { - if (!useDisplayBlockControls()) { - return null; - } - - const Fill = block_controls_groups[group].Fill; - return Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalStyleProvider"], { +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/hook.js +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + + + +function useBlockControlsFill(group, shareWithChildBlocks) { + const isDisplayed = useDisplayBlockControls(); + const { + clientId + } = useBlockEditContext(); + const isParentDisplayed = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getBlockName, + hasSelectedInnerBlock + } = select(store); + const { + hasBlockSupport + } = select(external_wp_blocks_namespaceObject.store); + return shareWithChildBlocks && hasBlockSupport(getBlockName(clientId), '__experimentalExposeControlsToChildren', false) && hasSelectedInnerBlock(clientId); + }, [shareWithChildBlocks, clientId]); + + if (isDisplayed) { + var _groups$group; + + return (_groups$group = block_controls_groups[group]) === null || _groups$group === void 0 ? void 0 : _groups$group.Fill; + } + + if (isParentDisplayed) { + return block_controls_groups.parent.Fill; + } + + return null; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/fill.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +function BlockControlsFill(_ref) { + let { + group = 'default', + controls, + children, + __experimentalShareWithChildBlocks = false + } = _ref; + const Fill = useBlockControlsFill(group, __experimentalShareWithChildBlocks); + + if (!Fill) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalStyleProvider, { document: document - }, Object(external_wp_element_["createElement"])(Fill, null, fillProps => { + }, (0,external_wp_element_namespaceObject.createElement)(Fill, null, fillProps => { // Children passed to BlockControlsFill will not have access to any // React Context whose Provider is part of the BlockControlsSlot tree. // So we re-create the Provider in this subtree. - const value = !Object(external_lodash_["isEmpty"])(fillProps) ? fillProps : null; - return Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalToolbarContext"].Provider, { + const value = !(0,external_lodash_namespaceObject.isEmpty)(fillProps) ? fillProps : null; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolbarContext.Provider, { value: value - }, group === 'default' && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], { + }, group === 'default' && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, { controls: controls }), children); })); } -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/slot.js - - - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -function BlockControlsSlot({ - group = 'default', - ...props -}) { - const accessibleToolbarState = Object(external_wp_element_["useContext"])(external_wp_components_["__experimentalToolbarContext"]); +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/slot.js + + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +function BlockControlsSlot(_ref) { + let { + group = 'default', + ...props + } = _ref; + const accessibleToolbarState = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.__experimentalToolbarContext); const Slot = block_controls_groups[group].Slot; - const slot = Object(external_wp_components_["__experimentalUseSlot"])(Slot.__unstableName); + const slot = (0,external_wp_components_namespaceObject.__experimentalUseSlot)(Slot.__unstableName); const hasFills = Boolean(slot.fills && slot.fills.length); if (!hasFills) { @@ -12575,19 +9509,19 @@ } if (group === 'default') { - return Object(external_wp_element_["createElement"])(Slot, Object(esm_extends["a" /* default */])({}, props, { + return (0,external_wp_element_namespaceObject.createElement)(Slot, _extends({}, props, { bubblesVirtually: true, fillProps: accessibleToolbarState })); } - return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(Slot, Object(esm_extends["a" /* default */])({}, props, { + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_wp_element_namespaceObject.createElement)(Slot, _extends({}, props, { bubblesVirtually: true, fillProps: accessibleToolbarState }))); } -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/index.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/index.js @@ -12597,113 +9531,213 @@ const BlockControls = BlockControlsFill; -BlockControls.Slot = BlockControlsSlot; // This is just here for backward compatibility +BlockControls.Slot = BlockControlsSlot; // This is just here for backward compatibility. const BlockFormatControls = props => { - return Object(external_wp_element_["createElement"])(BlockControlsFill, Object(esm_extends["a" /* default */])({ + return (0,external_wp_element_namespaceObject.createElement)(BlockControlsFill, _extends({ group: "inline" }, props)); }; BlockFormatControls.Slot = props => { - return Object(external_wp_element_["createElement"])(BlockControlsSlot, Object(esm_extends["a" /* default */])({ + return (0,external_wp_element_namespaceObject.createElement)(BlockControlsSlot, _extends({ group: "inline" }, props)); }; /* harmony default export */ var block_controls = (BlockControls); -// EXTERNAL MODULE: external ["wp","primitives"] -var external_wp_primitives_ = __webpack_require__("Tqx9"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/position-left.js - - -/** - * WordPress dependencies - */ - -const positionLeft = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/align-none.js + + +/** + * WordPress dependencies + */ + +const alignNone = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M5 15h14V9H5v6zm0 4.8h14v-1.5H5v1.5zM5 4.2v1.5h14V4.2H5z" +})); +/* harmony default export */ var align_none = (alignNone); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/position-left.js + + +/** + * WordPress dependencies + */ + +const positionLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { d: "M4 9v6h14V9H4zm8-4.8H4v1.5h8V4.2zM4 19.8h8v-1.5H4v1.5z" })); /* harmony default export */ var position_left = (positionLeft); -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/position-center.js - - -/** - * WordPress dependencies - */ - -const positionCenter = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { - d: "M5 15h14V9H5v6zm0 4.8h14v-1.5H5v1.5zM5 4.2v1.5h14V4.2H5z" +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/position-center.js + + +/** + * WordPress dependencies + */ + +const positionCenter = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M7 9v6h10V9H7zM5 19.8h14v-1.5H5v1.5zM5 4.3v1.5h14V4.3H5z" })); /* harmony default export */ var position_center = (positionCenter); -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/position-right.js - - -/** - * WordPress dependencies - */ - -const positionRight = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/position-right.js + + +/** + * WordPress dependencies + */ + +const positionRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { d: "M6 15h14V9H6v6zm6-10.8v1.5h8V4.2h-8zm0 15.6h8v-1.5h-8v1.5z" })); /* harmony default export */ var position_right = (positionRight); -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/stretch-wide.js - - -/** - * WordPress dependencies - */ - -const stretchWide = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/stretch-wide.js + + +/** + * WordPress dependencies + */ + +const stretchWide = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { d: "M5 9v6h14V9H5zm11-4.8H8v1.5h8V4.2zM8 19.8h8v-1.5H8v1.5z" })); /* harmony default export */ var stretch_wide = (stretchWide); -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/stretch-full-width.js - - -/** - * WordPress dependencies - */ - -const stretchFullWidth = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/stretch-full-width.js + + +/** + * WordPress dependencies + */ + +const stretchFullWidth = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { d: "M5 4v11h14V4H5zm3 15.8h8v-1.5H8v1.5z" })); /* harmony default export */ var stretch_full_width = (stretchFullWidth); -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/layout.js - - -/** - * WordPress dependencies - */ - -const layout_defaultLayout = { - type: 'default' -}; -const Layout = Object(external_wp_element_["createContext"])(layout_defaultLayout); - -function appendSelectors(selectors, append) { +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-left.js + + +/** + * WordPress dependencies + */ + +const justifyLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M9 9v6h11V9H9zM4 20h1.5V4H4v16z" +})); +/* harmony default export */ var justify_left = (justifyLeft); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-center.js + + +/** + * WordPress dependencies + */ + +const justifyCenter = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M20 9h-7.2V4h-1.6v5H4v6h7.2v5h1.6v-5H20z" +})); +/* harmony default export */ var justify_center = (justifyCenter); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-right.js + + +/** + * WordPress dependencies + */ + +const justifyRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M4 15h11V9H4v6zM18.5 4v16H20V4h-1.5z" +})); +/* harmony default export */ var justify_right = (justifyRight); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-space-between.js + + +/** + * WordPress dependencies + */ + +const justifySpaceBetween = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M9 15h6V9H9v6zm-5 5h1.5V4H4v16zM18.5 4v16H20V4h-1.5z" +})); +/* harmony default export */ var justify_space_between = (justifySpaceBetween); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-right.js + + +/** + * WordPress dependencies + */ + +const arrowRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M14.3 6.7l-1.1 1.1 4 4H4v1.5h13.3l-4.1 4.4 1.1 1.1 5.8-6.3z" +})); +/* harmony default export */ var arrow_right = (arrowRight); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-down.js + + +/** + * WordPress dependencies + */ + +const arrowDown = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M16.2 13.2l-4 4V4h-1.5v13.3l-4.5-4.1-1 1.1 6.2 5.8 5.8-5.8-1-1.1z" +})); +/* harmony default export */ var arrow_down = (arrowDown); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/layouts/utils.js +/** + * Utility to generate the proper CSS selector for layout styles. + * + * @param {string|string[]} selectors - CSS selectors + * @param {boolean} append - string to append. + * + * @return {string} - CSS selector. + */ +function appendSelectors(selectors) { + let append = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; // Ideally we shouldn't need the `.editor-styles-wrapper` increased specificity here // The problem though is that we have a `.editor-styles-wrapper p { margin: reset; }` style // it's used to reset the default margin added by wp-admin to paragraphs @@ -12711,104 +9745,1329 @@ // When the post editor is fully iframed, this extra classname could be removed. return selectors.split(',').map(subselector => `.editor-styles-wrapper ${subselector} ${append}`).join(','); } -/** - * Allows to define the layout. - */ - - -const LayoutProvider = Layout.Provider; -/** - * React hook used to retrieve the layout config. - */ - -function useLayout() { - return Object(external_wp_element_["useContext"])(Layout); -} -function LayoutStyle({ - selector, - layout = {} -}) { - const { - contentSize, - wideSize - } = layout; - let style = !!contentSize || !!wideSize ? ` - ${appendSelectors(selector, '> *')} { - max-width: ${contentSize !== null && contentSize !== void 0 ? contentSize : wideSize}; - margin-left: auto !important; - margin-right: auto !important; - } - - ${appendSelectors(selector, '> [data-align="wide"]')} { - max-width: ${wideSize !== null && wideSize !== void 0 ? wideSize : contentSize}; - } - - ${appendSelectors(selector, '> [data-align="full"]')} { - max-width: none; - } - ` : ''; - style += ` - ${appendSelectors(selector, '> [data-align="left"]')} { - float: left; - margin-right: 2em; - } - - ${appendSelectors(selector, '> [data-align="right"]')} { - float: right; - margin-left: 2em; - } - `; - return Object(external_wp_element_["createElement"])("style", null, style); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/use-available-alignments.js -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - - -const DEFAULT_CONTROLS = ['left', 'center', 'right', 'wide', 'full']; -const WIDE_CONTROLS = ['wide', 'full']; -function useAvailableAlignments(controls = DEFAULT_CONTROLS) { - const { - wideControlsEnabled = false - } = Object(external_wp_data_["useSelect"])(select => { - const { - getSettings - } = select(store); - const settings = getSettings(); - return { - wideControlsEnabled: settings.alignWide - }; - }, []); - const layout = useLayout(); - const supportsAlignments = layout.type === 'default'; - - if (!supportsAlignments) { - return []; - } - - const { - alignments: availableAlignments = DEFAULT_CONTROLS - } = layout; - const enabledControls = controls.filter(control => (layout.alignments || // Ignore the global wideAlignment check if the layout explicitely defines alignments. - wideControlsEnabled || !WIDE_CONTROLS.includes(control)) && availableAlignments.includes(control)); - return enabledControls; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/ui.js - - - -/** - * WordPress dependencies - */ - + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/block-refs-provider.js + + +/** + * WordPress dependencies + */ + +const BlockRefs = (0,external_wp_element_namespaceObject.createContext)({ + refs: new Map(), + callbacks: new Map() +}); +function BlockRefsProvider(_ref) { + let { + children + } = _ref; + const value = (0,external_wp_element_namespaceObject.useMemo)(() => ({ + refs: new Map(), + callbacks: new Map() + }), []); + return (0,external_wp_element_namespaceObject.createElement)(BlockRefs.Provider, { + value: value + }, children); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-refs.js +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +/** @typedef {import('@wordpress/element').RefCallback} RefCallback */ + +/** @typedef {import('@wordpress/element').RefObject} RefObject */ + +/** + * Provides a ref to the BlockRefs context. + * + * @param {string} clientId The client ID of the element ref. + * + * @return {RefCallback} Ref callback. + */ + +function useBlockRefProvider(clientId) { + const { + refs, + callbacks + } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs); + const ref = (0,external_wp_element_namespaceObject.useRef)(); + (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { + refs.set(ref, clientId); + return () => { + refs.delete(ref); + }; + }, [clientId]); + return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { + // Update the ref in the provider. + ref.current = element; // Call any update functions. + + callbacks.forEach((id, setElement) => { + if (clientId === id) { + setElement(element); + } + }); + }, [clientId]); +} +/** + * Gets a ref pointing to the current block element. Continues to return a + * stable ref even if the block client ID changes. + * + * @param {string} clientId The client ID to get a ref for. + * + * @return {RefObject} A ref containing the element. + */ + +function useBlockRef(clientId) { + const { + refs + } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs); + const freshClientId = (0,external_wp_element_namespaceObject.useRef)(); + freshClientId.current = clientId; // Always return an object, even if no ref exists for a given client ID, so + // that `current` works at a later point. + + return (0,external_wp_element_namespaceObject.useMemo)(() => ({ + get current() { + let element = null; // Multiple refs may be created for a single block. Find the + // first that has an element set. + + for (const [ref, id] of refs.entries()) { + if (id === freshClientId.current && ref.current) { + element = ref.current; + } + } + + return element; + } + + }), []); +} +/** + * Return the element for a given client ID. Updates whenever the element + * changes, becomes available, or disappears. + * + * @param {string} clientId The client ID to an element for. + * + * @return {Element|null} The block's wrapper element. + */ + + +function useBlockElement(clientId) { + const { + callbacks + } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs); + const ref = useBlockRef(clientId); + const [element, setElement] = (0,external_wp_element_namespaceObject.useState)(null); + (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { + if (!clientId) { + return; + } + + callbacks.set(setElement, clientId); + return () => { + callbacks.delete(setElement); + }; + }, [clientId]); + return ref.current || element; +} + + + + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-setting/index.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + +const blockedPaths = ['color', 'border', 'typography', 'spacing']; +const deprecatedFlags = { + 'color.palette': settings => settings.colors === undefined ? undefined : settings.colors, + 'color.gradients': settings => settings.gradients === undefined ? undefined : settings.gradients, + 'color.custom': settings => settings.disableCustomColors === undefined ? undefined : !settings.disableCustomColors, + 'color.customGradient': settings => settings.disableCustomGradients === undefined ? undefined : !settings.disableCustomGradients, + 'typography.fontSizes': settings => settings.fontSizes === undefined ? undefined : settings.fontSizes, + 'typography.customFontSize': settings => settings.disableCustomFontSizes === undefined ? undefined : !settings.disableCustomFontSizes, + 'typography.lineHeight': settings => settings.enableCustomLineHeight, + 'spacing.units': settings => { + if (settings.enableCustomUnits === undefined) { + return; + } + + if (settings.enableCustomUnits === true) { + return ['px', 'em', 'rem', 'vh', 'vw', '%']; + } + + return settings.enableCustomUnits; + }, + 'spacing.padding': settings => settings.enableCustomSpacing +}; +const prefixedFlags = { + /* + * These were only available in the plugin + * and can be removed when the minimum WordPress version + * for the plugin is 5.9. + */ + 'border.customColor': 'border.color', + 'border.customStyle': 'border.style', + 'border.customWidth': 'border.width', + 'typography.customFontStyle': 'typography.fontStyle', + 'typography.customFontWeight': 'typography.fontWeight', + 'typography.customLetterSpacing': 'typography.letterSpacing', + 'typography.customTextDecorations': 'typography.textDecoration', + 'typography.customTextTransforms': 'typography.textTransform', + + /* + * These were part of WordPress 5.8 and we need to keep them. + */ + 'border.customRadius': 'border.radius', + 'spacing.customMargin': 'spacing.margin', + 'spacing.customPadding': 'spacing.padding', + 'typography.customLineHeight': 'typography.lineHeight' +}; +/** + * Remove `custom` prefixes for flags that did not land in 5.8. + * + * This provides continued support for `custom` prefixed properties. It will + * be removed once third party devs have had sufficient time to update themes, + * plugins, etc. + * + * @see https://github.com/WordPress/gutenberg/pull/34485 + * + * @param {string} path Path to desired value in settings. + * @return {string} The value for defined setting. + */ + +const removeCustomPrefixes = path => { + return prefixedFlags[path] || path; +}; +/** + * Hook that retrieves the editor setting. + * It works with nested objects using by finding the value at path. + * + * @param {string} path The path to the setting. + * @return {any} Returns the value defined for the setting. + * @example + * ```js + * const isEnabled = useSetting( 'typography.dropCap' ); + * ``` + */ + + +function useSetting(path) { + const { + name: blockName + } = useBlockEditContext(); + const setting = (0,external_wp_data_namespaceObject.useSelect)(select => { + var _get; + + if (blockedPaths.includes(path)) { + // eslint-disable-next-line no-console + console.warn('Top level useSetting paths are disabled. Please use a subpath to query the information needed.'); + return undefined; + } + + const settings = select(store).getSettings(); // 1 - Use __experimental features, if available. + // We cascade to the all value if the block one is not available. + + const normalizedPath = removeCustomPrefixes(path); + const defaultsPath = `__experimentalFeatures.${normalizedPath}`; + const blockPath = `__experimentalFeatures.blocks.${blockName}.${normalizedPath}`; + const experimentalFeaturesResult = (_get = (0,external_lodash_namespaceObject.get)(settings, blockPath)) !== null && _get !== void 0 ? _get : (0,external_lodash_namespaceObject.get)(settings, defaultsPath); + + if (experimentalFeaturesResult !== undefined) { + if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_MERGE[normalizedPath]) { + var _ref, _experimentalFeatures; + + return (_ref = (_experimentalFeatures = experimentalFeaturesResult.custom) !== null && _experimentalFeatures !== void 0 ? _experimentalFeatures : experimentalFeaturesResult.theme) !== null && _ref !== void 0 ? _ref : experimentalFeaturesResult.default; + } + + return experimentalFeaturesResult; + } // 2 - Use deprecated settings, otherwise. + + + const deprecatedSettingsValue = deprecatedFlags[normalizedPath] ? deprecatedFlags[normalizedPath](settings) : undefined; + + if (deprecatedSettingsValue !== undefined) { + return deprecatedSettingsValue; + } // 3 - Fall back for typography.dropCap: + // This is only necessary to support typography.dropCap. + // when __experimentalFeatures are not present (core without plugin). + // To remove when __experimentalFeatures are ported to core. + + + return normalizedPath === 'typography.dropCap' ? true : undefined; + }, [blockName, path]); + return setting; +} + +;// CONCATENATED MODULE: external ["wp","warning"] +var external_wp_warning_namespaceObject = window["wp"]["warning"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/groups.js +/** + * WordPress dependencies + */ + +const InspectorControlsDefault = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControls'); +const InspectorControlsAdvanced = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorAdvancedControls'); +const InspectorControlsBorder = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsBorder'); +const InspectorControlsColor = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsColor'); +const InspectorControlsDimensions = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsDimensions'); +const InspectorControlsTypography = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsTypography'); +const groups_groups = { + default: InspectorControlsDefault, + advanced: InspectorControlsAdvanced, + border: InspectorControlsBorder, + color: InspectorControlsColor, + dimensions: InspectorControlsDimensions, + typography: InspectorControlsTypography +}; +/* harmony default export */ var inspector_controls_groups = (groups_groups); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/fill.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + +function InspectorControlsFill(_ref) { + var _groups$group; + + let { + __experimentalGroup: group = 'default', + children + } = _ref; + const isDisplayed = useDisplayBlockControls(); + const Fill = (_groups$group = inspector_controls_groups[group]) === null || _groups$group === void 0 ? void 0 : _groups$group.Fill; + + if (!Fill) { + typeof process !== "undefined" && process.env && "production" !== "production" ? 0 : void 0; + return null; + } + + if (!isDisplayed) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalStyleProvider, { + document: document + }, (0,external_wp_element_namespaceObject.createElement)(Fill, null, fillProps => { + // Children passed to InspectorControlsFill will not have + // access to any React Context whose Provider is part of + // the InspectorControlsSlot tree. So we re-create the + // Provider in this subtree. + const value = !(0,external_lodash_namespaceObject.isEmpty)(fillProps) ? fillProps : null; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelContext.Provider, { + value: value + }, children); + })); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/utils.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +/** + * Removed falsy values from nested object. + * + * @param {*} object + * @return {*} Object cleaned from falsy values + */ + +const cleanEmptyObject = object => { + if (!(0,external_lodash_namespaceObject.isObject)(object) || Array.isArray(object)) { + return object; + } + + const cleanedNestedObjects = (0,external_lodash_namespaceObject.pickBy)((0,external_lodash_namespaceObject.mapValues)(object, cleanEmptyObject), external_lodash_namespaceObject.identity); + return (0,external_lodash_namespaceObject.isEmpty)(cleanedNestedObjects) ? undefined : cleanedNestedObjects; +}; +function immutableSet(object, path, value) { + return (0,external_lodash_namespaceObject.setWith)(object ? (0,external_lodash_namespaceObject.clone)(object) : {}, path, value, external_lodash_namespaceObject.clone); +} +function transformStyles(activeSupports, migrationPaths, result, source, index, results) { + var _source$; + + // If there are no active supports return early. + if ((0,external_lodash_namespaceObject.every)(activeSupports, isActive => !isActive)) { + return result; + } // If the condition verifies we are probably in the presence of a wrapping transform + // e.g: nesting paragraphs in a group or columns and in that case the styles should not be transformed. + + + if (results.length === 1 && result.innerBlocks.length === source.length) { + return result; + } // For cases where we have a transform from one block to multiple blocks + // or multiple blocks to one block we apply the styles of the first source block + // to the result(s). + + + let referenceBlockAttributes = (_source$ = source[0]) === null || _source$ === void 0 ? void 0 : _source$.attributes; // If we are in presence of transform between more than one block in the source + // that has more than one block in the result + // we apply the styles on source N to the result N, + // if source N does not exists we do nothing. + + if (results.length > 1 && source.length > 1) { + if (source[index]) { + var _source$index; + + referenceBlockAttributes = (_source$index = source[index]) === null || _source$index === void 0 ? void 0 : _source$index.attributes; + } else { + return result; + } + } + + let returnBlock = result; + (0,external_lodash_namespaceObject.forEach)(activeSupports, (isActive, support) => { + if (isActive) { + migrationPaths[support].forEach(path => { + const styleValue = (0,external_lodash_namespaceObject.get)(referenceBlockAttributes, path); + + if (styleValue) { + returnBlock = { ...returnBlock, + attributes: immutableSet(returnBlock.attributes, path, styleValue) + }; + } + }); + } + }); + return returnBlock; +} +/** + * Check whether serialization of specific block support feature or set should + * be skipped. + * + * @param {string|Object} blockType Block name or block type object. + * @param {string} featureSet Name of block support feature set. + * @param {string} feature Name of the individual feature to check. + * + * @return {boolean} Whether serialization should occur. + */ + +function shouldSkipSerialization(blockType, featureSet, feature) { + const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, featureSet); + const skipSerialization = support === null || support === void 0 ? void 0 : support.__experimentalSkipSerialization; + + if (Array.isArray(skipSerialization)) { + return skipSerialization.includes(feature); + } + + return skipSerialization; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/block-support-tools-panel.js + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + +function BlockSupportToolsPanel(_ref) { + let { + children, + group, + label + } = _ref; + const { + updateBlockAttributes + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const { + getBlockAttributes, + getMultiSelectedBlockClientIds, + getSelectedBlockClientId, + hasMultiSelection + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const panelId = getSelectedBlockClientId(); + const resetAll = (0,external_wp_element_namespaceObject.useCallback)(function () { + let resetFilters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + const newAttributes = {}; + const clientIds = hasMultiSelection() ? getMultiSelectedBlockClientIds() : [panelId]; + clientIds.forEach(clientId => { + const { + style + } = getBlockAttributes(clientId); + let newBlockAttributes = { + style + }; + resetFilters.forEach(resetFilter => { + newBlockAttributes = { ...newBlockAttributes, + ...resetFilter(newBlockAttributes) + }; + }); // Enforce a cleaned style object. + + newBlockAttributes = { ...newBlockAttributes, + style: cleanEmptyObject(newBlockAttributes.style) + }; + newAttributes[clientId] = newBlockAttributes; + }); + updateBlockAttributes(clientIds, newAttributes, true); + }, [cleanEmptyObject, getBlockAttributes, getMultiSelectedBlockClientIds, hasMultiSelection, panelId, updateBlockAttributes]); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, { + className: `${group}-block-support-panel`, + label: label, + resetAll: resetAll, + key: panelId, + panelId: panelId, + hasInnerWrapper: true, + shouldRenderPlaceholderItems: true // Required to maintain fills ordering. + , + __experimentalFirstVisibleItemClass: "first", + __experimentalLastVisibleItemClass: "last" + }, children); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/block-support-slot-container.js + + + +/** + * WordPress dependencies + */ + + +function BlockSupportSlotContainer(_ref) { + let { + Slot, + ...props + } = _ref; + const toolsPanelContext = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.__experimentalToolsPanelContext); + return (0,external_wp_element_namespaceObject.createElement)(Slot, _extends({}, props, { + fillProps: toolsPanelContext, + bubblesVirtually: true + })); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/slot.js + + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + + +function InspectorControlsSlot(_ref) { + var _groups$group; + + let { + __experimentalGroup: group = 'default', + label, + ...props + } = _ref; + const Slot = (_groups$group = inspector_controls_groups[group]) === null || _groups$group === void 0 ? void 0 : _groups$group.Slot; + const slot = (0,external_wp_components_namespaceObject.__experimentalUseSlot)(Slot === null || Slot === void 0 ? void 0 : Slot.__unstableName); + + if (!Slot || !slot) { + typeof process !== "undefined" && process.env && "production" !== "production" ? 0 : void 0; + return null; + } + + const hasFills = Boolean(slot.fills && slot.fills.length); + + if (!hasFills) { + return null; + } + + if (label) { + return (0,external_wp_element_namespaceObject.createElement)(BlockSupportToolsPanel, { + group: group, + label: label + }, (0,external_wp_element_namespaceObject.createElement)(BlockSupportSlotContainer, _extends({}, props, { + Slot: Slot + }))); + } + + return (0,external_wp_element_namespaceObject.createElement)(Slot, _extends({}, props, { + bubblesVirtually: true + })); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/index.js + + + +/** + * Internal dependencies + */ + + +const InspectorControls = InspectorControlsFill; +InspectorControls.Slot = InspectorControlsSlot; // This is just here for backward compatibility. + +const InspectorAdvancedControls = props => { + return (0,external_wp_element_namespaceObject.createElement)(InspectorControlsFill, _extends({}, props, { + __experimentalGroup: "advanced" + })); +}; + +InspectorAdvancedControls.Slot = props => { + return (0,external_wp_element_namespaceObject.createElement)(InspectorControlsSlot, _extends({}, props, { + __experimentalGroup: "advanced" + })); +}; + +InspectorAdvancedControls.slotName = 'InspectorAdvancedControls'; +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inspector-controls/README.md + */ + +/* harmony default export */ var inspector_controls = (InspectorControls); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/margin.js + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + +/** + * Determines if there is margin support. + * + * @param {string|Object} blockType Block name or Block Type object. + * + * @return {boolean} Whether there is support. + */ + +function hasMarginSupport(blockType) { + const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, SPACING_SUPPORT_KEY); + return !!(true === support || support !== null && support !== void 0 && support.margin); +} +/** + * Checks if there is a current value in the margin block support attributes. + * + * @param {Object} props Block props. + * @return {boolean} Whether or not the block has a margin value set. + */ + +function hasMarginValue(props) { + var _props$attributes$sty, _props$attributes$sty2; + + return ((_props$attributes$sty = props.attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : (_props$attributes$sty2 = _props$attributes$sty.spacing) === null || _props$attributes$sty2 === void 0 ? void 0 : _props$attributes$sty2.margin) !== undefined; +} +/** + * Resets the margin block support attributes. This can be used when disabling + * the margin support controls for a block via a `ToolsPanel`. + * + * @param {Object} props Block props. + * @param {Object} props.attributes Block's attributes. + * @param {Object} props.setAttributes Function to set block's attributes. + */ + +function resetMargin(_ref) { + let { + attributes = {}, + setAttributes + } = _ref; + const { + style + } = attributes; + setAttributes({ + style: cleanEmptyObject({ ...style, + spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing), + margin: undefined + } + }) + }); +} +/** + * Custom hook that checks if margin settings have been disabled. + * + * @param {string} name The name of the block. + * + * @return {boolean} Whether margin setting is disabled. + */ + +function useIsMarginDisabled() { + let { + name: blockName + } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + const isDisabled = !useSetting('spacing.margin'); + const isInvalid = !useIsDimensionsSupportValid(blockName, 'margin'); + return !hasMarginSupport(blockName) || isDisabled || isInvalid; +} +/** + * Inspector control panel containing the margin related configuration + * + * @param {Object} props Block props. + * + * @return {WPElement} Margin edit element. + */ + +function MarginEdit(props) { + var _style$spacing; + + const { + name: blockName, + attributes: { + style + }, + setAttributes + } = props; + const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ + availableUnits: useSetting('spacing.units') || ['%', 'px', 'em', 'rem', 'vw'] + }); + const sides = useCustomSides(blockName, 'margin'); + const splitOnAxis = sides && sides.some(side => AXIAL_SIDES.includes(side)); + + if (useIsMarginDisabled(props)) { + return null; + } + + const onChange = next => { + const newStyle = { ...style, + spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing), + margin: next + } + }; + setAttributes({ + style: cleanEmptyObject(newStyle) + }); + }; + + const onChangeShowVisualizer = next => { + const newStyle = { ...style, + visualizers: { + margin: next + } + }; + setAttributes({ + style: cleanEmptyObject(newStyle) + }); + }; + + return external_wp_element_namespaceObject.Platform.select({ + web: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, { + values: style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.margin, + onChange: onChange, + onChangeShowVisualizer: onChangeShowVisualizer, + label: (0,external_wp_i18n_namespaceObject.__)('Margin'), + sides: sides, + units: units, + allowReset: false, + splitOnAxis: splitOnAxis + })), + native: null + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/padding.js + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + +/** + * Determines if there is padding support. + * + * @param {string|Object} blockType Block name or Block Type object. + * + * @return {boolean} Whether there is support. + */ + +function hasPaddingSupport(blockType) { + const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, SPACING_SUPPORT_KEY); + return !!(true === support || support !== null && support !== void 0 && support.padding); +} +/** + * Checks if there is a current value in the padding block support attributes. + * + * @param {Object} props Block props. + * @return {boolean} Whether or not the block has a padding value set. + */ + +function hasPaddingValue(props) { + var _props$attributes$sty, _props$attributes$sty2; + + return ((_props$attributes$sty = props.attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : (_props$attributes$sty2 = _props$attributes$sty.spacing) === null || _props$attributes$sty2 === void 0 ? void 0 : _props$attributes$sty2.padding) !== undefined; +} +/** + * Resets the padding block support attributes. This can be used when disabling + * the padding support controls for a block via a `ToolsPanel`. + * + * @param {Object} props Block props. + * @param {Object} props.attributes Block's attributes. + * @param {Object} props.setAttributes Function to set block's attributes. + */ + +function resetPadding(_ref) { + let { + attributes = {}, + setAttributes + } = _ref; + const { + style + } = attributes; + setAttributes({ + style: cleanEmptyObject({ ...style, + spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing), + padding: undefined + } + }) + }); +} +/** + * Custom hook that checks if padding settings have been disabled. + * + * @param {string} name The name of the block. + * + * @return {boolean} Whether padding setting is disabled. + */ + +function useIsPaddingDisabled() { + let { + name: blockName + } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + const isDisabled = !useSetting('spacing.padding'); + const isInvalid = !useIsDimensionsSupportValid(blockName, 'padding'); + return !hasPaddingSupport(blockName) || isDisabled || isInvalid; +} +/** + * Inspector control panel containing the padding related configuration + * + * @param {Object} props + * + * @return {WPElement} Padding edit element. + */ + +function PaddingEdit(props) { + var _style$spacing; + + const { + name: blockName, + attributes: { + style + }, + setAttributes + } = props; + const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ + availableUnits: useSetting('spacing.units') || ['%', 'px', 'em', 'rem', 'vw'] + }); + const sides = useCustomSides(blockName, 'padding'); + const splitOnAxis = sides && sides.some(side => AXIAL_SIDES.includes(side)); + + if (useIsPaddingDisabled(props)) { + return null; + } + + const onChange = next => { + const newStyle = { ...style, + spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing), + padding: next + } + }; + setAttributes({ + style: cleanEmptyObject(newStyle) + }); + }; + + const onChangeShowVisualizer = next => { + const newStyle = { ...style, + visualizers: { + padding: next + } + }; + setAttributes({ + style: cleanEmptyObject(newStyle) + }); + }; + + return external_wp_element_namespaceObject.Platform.select({ + web: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, { + values: style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.padding, + onChange: onChange, + onChangeShowVisualizer: onChangeShowVisualizer, + label: (0,external_wp_i18n_namespaceObject.__)('Padding'), + sides: sides, + units: units, + allowReset: false, + splitOnAxis: splitOnAxis + })), + native: null + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/dimensions.js + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + + +const SPACING_SUPPORT_KEY = 'spacing'; +const ALL_SIDES = ['top', 'right', 'bottom', 'left']; +const AXIAL_SIDES = ['vertical', 'horizontal']; +/** + * Inspector controls for dimensions support. + * + * @param {Object} props Block props. + * + * @return {WPElement} Inspector controls for spacing support features. + */ + +function DimensionsPanel(props) { + const isGapDisabled = useIsGapDisabled(props); + const isPaddingDisabled = useIsPaddingDisabled(props); + const isMarginDisabled = useIsMarginDisabled(props); + const isDisabled = useIsDimensionsDisabled(props); + const isSupported = hasDimensionsSupport(props.name); + + if (isDisabled || !isSupported) { + return null; + } + + const defaultSpacingControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(props.name, [SPACING_SUPPORT_KEY, '__experimentalDefaultControls']); + + const createResetAllFilter = attribute => newAttributes => { + var _newAttributes$style; + + return { ...newAttributes, + style: { ...newAttributes.style, + spacing: { ...((_newAttributes$style = newAttributes.style) === null || _newAttributes$style === void 0 ? void 0 : _newAttributes$style.spacing), + [attribute]: undefined + } + } + }; + }; + + return (0,external_wp_element_namespaceObject.createElement)(inspector_controls, { + __experimentalGroup: "dimensions" + }, !isPaddingDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + hasValue: () => hasPaddingValue(props), + label: (0,external_wp_i18n_namespaceObject.__)('Padding'), + onDeselect: () => resetPadding(props), + resetAllFilter: createResetAllFilter('padding'), + isShownByDefault: defaultSpacingControls === null || defaultSpacingControls === void 0 ? void 0 : defaultSpacingControls.padding, + panelId: props.clientId + }, (0,external_wp_element_namespaceObject.createElement)(PaddingEdit, props)), !isMarginDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + hasValue: () => hasMarginValue(props), + label: (0,external_wp_i18n_namespaceObject.__)('Margin'), + onDeselect: () => resetMargin(props), + resetAllFilter: createResetAllFilter('margin'), + isShownByDefault: defaultSpacingControls === null || defaultSpacingControls === void 0 ? void 0 : defaultSpacingControls.margin, + panelId: props.clientId + }, (0,external_wp_element_namespaceObject.createElement)(MarginEdit, props)), !isGapDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + hasValue: () => hasGapValue(props), + label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), + onDeselect: () => resetGap(props), + resetAllFilter: createResetAllFilter('blockGap'), + isShownByDefault: defaultSpacingControls === null || defaultSpacingControls === void 0 ? void 0 : defaultSpacingControls.blockGap, + panelId: props.clientId + }, (0,external_wp_element_namespaceObject.createElement)(GapEdit, props))); +} +/** + * Determine whether there is dimensions related block support. + * + * @param {string} blockName Block name. + * + * @return {boolean} Whether there is support. + */ + +function hasDimensionsSupport(blockName) { + if (external_wp_element_namespaceObject.Platform.OS !== 'web') { + return false; + } + + return hasGapSupport(blockName) || hasPaddingSupport(blockName) || hasMarginSupport(blockName); +} +/** + * Determines whether dimensions support has been disabled. + * + * @param {Object} props Block properties. + * + * @return {boolean} If spacing support is completely disabled. + */ + +const useIsDimensionsDisabled = function () { + let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + const gapDisabled = useIsGapDisabled(props); + const paddingDisabled = useIsPaddingDisabled(props); + const marginDisabled = useIsMarginDisabled(props); + return gapDisabled && paddingDisabled && marginDisabled; +}; +/** + * Custom hook to retrieve which padding/margin/blockGap is supported + * e.g. top, right, bottom or left. + * + * Sides are opted into by default. It is only if a specific side is set to + * false that it is omitted. + * + * @param {string} blockName Block name. + * @param {string} feature The feature custom sides relate to e.g. padding or margins. + * + * @return {?string[]} Strings representing the custom sides available. + */ + + +function useCustomSides(blockName, feature) { + var _support$feature; + + const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, SPACING_SUPPORT_KEY); // Skip when setting is boolean as theme isn't setting arbitrary sides. + + if (!support || typeof support[feature] === 'boolean') { + return; + } // Return if the setting is an array of sides (e.g. `[ 'top', 'bottom' ]`). + + + if (Array.isArray(support[feature])) { + return support[feature]; + } // Finally, attempt to return `.sides` if the setting is an object. + + + if ((_support$feature = support[feature]) !== null && _support$feature !== void 0 && _support$feature.sides) { + return support[feature].sides; + } +} +/** + * Custom hook to determine whether the sides configured in the + * block support are valid. A dimension property cannot declare + * support for a mix of axial and individual sides. + * + * @param {string} blockName Block name. + * @param {string} feature The feature custom sides relate to e.g. padding or margins. + * + * @return {boolean} If the feature has a valid configuration of sides. + */ + +function useIsDimensionsSupportValid(blockName, feature) { + const sides = useCustomSides(blockName, feature); + + if (sides && sides.some(side => ALL_SIDES.includes(side)) && sides.some(side => AXIAL_SIDES.includes(side))) { + // eslint-disable-next-line no-console + console.warn(`The ${feature} support for the "${blockName}" block can not be configured to support both axial and arbitrary sides.`); + return false; + } + + return true; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/gap.js + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + + +/** + * Determines if there is gap support. + * + * @param {string|Object} blockType Block name or Block Type object. + * @return {boolean} Whether there is support. + */ + +function hasGapSupport(blockType) { + const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, SPACING_SUPPORT_KEY); + return !!(true === support || support !== null && support !== void 0 && support.blockGap); +} +/** + * Checks if there is a current value in the gap block support attributes. + * + * @param {Object} props Block props. + * @return {boolean} Whether or not the block has a gap value set. + */ + +function hasGapValue(props) { + var _props$attributes$sty, _props$attributes$sty2; + + return ((_props$attributes$sty = props.attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : (_props$attributes$sty2 = _props$attributes$sty.spacing) === null || _props$attributes$sty2 === void 0 ? void 0 : _props$attributes$sty2.blockGap) !== undefined; +} +/** + * Returns a BoxControl object value from a given blockGap style value. + * The string check is for backwards compatibility before Gutenberg supported + * split gap values (row and column) and the value was a string n + unit. + * + * @param {string? | Object?} blockGapValue A block gap string or axial object value, e.g., '10px' or { top: '10px', left: '10px'}. + * @return {Object|null} A value to pass to the BoxControl component. + */ + +function getGapBoxControlValueFromStyle(blockGapValue) { + if (!blockGapValue) { + return null; + } + + const isValueString = typeof blockGapValue === 'string'; + return { + top: isValueString ? blockGapValue : blockGapValue === null || blockGapValue === void 0 ? void 0 : blockGapValue.top, + left: isValueString ? blockGapValue : blockGapValue === null || blockGapValue === void 0 ? void 0 : blockGapValue.left + }; +} +/** + * Returns a CSS value for the `gap` property from a given blockGap style. + * + * @param {string? | Object?} blockGapValue A block gap string or axial object value, e.g., '10px' or { top: '10px', left: '10px'}. + * @param {string?} defaultValue A default gap value. + * @return {string|null} The concatenated gap value (row and column). + */ + +function getGapCSSValue(blockGapValue) { + let defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '0'; + const blockGapBoxControlValue = getGapBoxControlValueFromStyle(blockGapValue); + + if (!blockGapBoxControlValue) { + return null; + } + + const row = (blockGapBoxControlValue === null || blockGapBoxControlValue === void 0 ? void 0 : blockGapBoxControlValue.top) || defaultValue; + const column = (blockGapBoxControlValue === null || blockGapBoxControlValue === void 0 ? void 0 : blockGapBoxControlValue.left) || defaultValue; + return row === column ? row : `${row} ${column}`; +} +/** + * Resets the gap block support attribute. This can be used when disabling + * the gap support controls for a block via a progressive discovery panel. + * + * @param {Object} props Block props. + * @param {Object} props.attributes Block's attributes. + * @param {Object} props.setAttributes Function to set block's attributes. + */ + +function resetGap(_ref) { + let { + attributes = {}, + setAttributes + } = _ref; + const { + style + } = attributes; + setAttributes({ + style: { ...style, + spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing), + blockGap: undefined + } + } + }); +} +/** + * Custom hook that checks if gap settings have been disabled. + * + * @param {string} name The name of the block. + * @return {boolean} Whether the gap setting is disabled. + */ + +function useIsGapDisabled() { + let { + name: blockName + } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + const isDisabled = !useSetting('spacing.blockGap'); + return !hasGapSupport(blockName) || isDisabled; +} +/** + * Inspector control panel containing the gap related configuration + * + * @param {Object} props + * + * @return {WPElement} Gap edit element. + */ + +function GapEdit(props) { + var _style$spacing; + + const { + clientId, + attributes: { + style + }, + name: blockName, + setAttributes + } = props; + const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ + availableUnits: useSetting('spacing.units') || ['%', 'px', 'em', 'rem', 'vw'] + }); + const sides = useCustomSides(blockName, 'blockGap'); + const ref = useBlockRef(clientId); + + if (useIsGapDisabled(props)) { + return null; + } + + const splitOnAxis = sides && sides.some(side => AXIAL_SIDES.includes(side)); + + const onChange = next => { + var _window; + + let blockGap = next; // If splitOnAxis activated we need to return a BoxControl object to the BoxControl component. + + if (!!next && splitOnAxis) { + blockGap = { ...getGapBoxControlValueFromStyle(next) + }; + } + + const newStyle = { ...style, + spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing), + blockGap + } + }; + setAttributes({ + style: cleanEmptyObject(newStyle) + }); // In Safari, changing the `gap` CSS value on its own will not trigger the layout + // to be recalculated / re-rendered. To force the updated gap to re-render, here + // we replace the block's node with itself. + + const isSafari = ((_window = window) === null || _window === void 0 ? void 0 : _window.navigator.userAgent) && window.navigator.userAgent.includes('Safari') && !window.navigator.userAgent.includes('Chrome ') && !window.navigator.userAgent.includes('Chromium '); + + if (ref.current && isSafari) { + var _ref$current$parentNo; + + (_ref$current$parentNo = ref.current.parentNode) === null || _ref$current$parentNo === void 0 ? void 0 : _ref$current$parentNo.replaceChild(ref.current, ref.current); + } + }; + + const gapValue = getGapBoxControlValueFromStyle(style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.blockGap); // The BoxControl component expects a full complement of side values. + // Gap row and column values translate to top/bottom and left/right respectively. + + const boxControlGapValue = splitOnAxis ? { ...gapValue, + right: gapValue === null || gapValue === void 0 ? void 0 : gapValue.left, + bottom: gapValue === null || gapValue === void 0 ? void 0 : gapValue.top + } : gapValue === null || gapValue === void 0 ? void 0 : gapValue.top; + return external_wp_element_namespaceObject.Platform.select({ + web: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, splitOnAxis ? (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), + min: 0, + onChange: onChange, + units: units, + sides: sides, + values: boxControlGapValue, + allowReset: false, + splitOnAxis: splitOnAxis + }) : (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), + __unstableInputWidth: "80px", + min: 0, + onChange: onChange, + units: units // Default to `row` for combined values. + , + value: boxControlGapValue + })), + native: null + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/icons.js + + +/** + * WordPress dependencies + */ + +const alignBottom = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, { + d: "M15 4H9v11h6V4zM4 18.5V20h16v-1.5H4z" +})); +const alignCenter = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, { + d: "M20 11h-5V4H9v7H4v1.5h5V20h6v-7.5h5z" +})); +const alignTop = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, { + d: "M9 20h6V9H9v11zM4 4v1.5h16V4H4z" +})); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/ui.js + + + +/** + * WordPress dependencies + */ /** @@ -12817,63 +11076,49 @@ const BLOCK_ALIGNMENTS_CONTROLS = { - left: { - icon: position_left, - title: Object(external_wp_i18n_["__"])('Align left') + top: { + icon: alignTop, + title: (0,external_wp_i18n_namespaceObject._x)('Align top', 'Block vertical alignment setting') }, center: { - icon: position_center, - title: Object(external_wp_i18n_["__"])('Align center') - }, - right: { - icon: position_right, - title: Object(external_wp_i18n_["__"])('Align right') - }, - wide: { - icon: stretch_wide, - title: Object(external_wp_i18n_["__"])('Wide width') - }, - full: { - icon: stretch_full_width, - title: Object(external_wp_i18n_["__"])('Full width') - } -}; -const DEFAULT_CONTROL = 'center'; -const ui_POPOVER_PROPS = { + icon: alignCenter, + title: (0,external_wp_i18n_namespaceObject._x)('Align middle', 'Block vertical alignment setting') + }, + bottom: { + icon: alignBottom, + title: (0,external_wp_i18n_namespaceObject._x)('Align bottom', 'Block vertical alignment setting') + } +}; +const DEFAULT_CONTROLS = ['top', 'center', 'bottom']; +const DEFAULT_CONTROL = 'top'; +const POPOVER_PROPS = { isAlternate: true }; -function BlockAlignmentUI({ - value, - onChange, - controls, - isToolbar, - isCollapsed = true -}) { - const enabledControls = useAvailableAlignments(controls); - - if (enabledControls.length === 0) { - return null; - } +function BlockVerticalAlignmentUI(_ref) { + let { + value, + onChange, + controls = DEFAULT_CONTROLS, + isCollapsed = true, + isToolbar + } = _ref; function applyOrUnset(align) { return () => onChange(value === align ? undefined : align); } - const activeAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[value]; + const activeAlignment = BLOCK_ALIGNMENTS_CONTROLS[value]; const defaultAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[DEFAULT_CONTROL]; - const UIComponent = isToolbar ? external_wp_components_["ToolbarGroup"] : external_wp_components_["ToolbarDropdownMenu"]; + const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu; const extraProps = isToolbar ? { isCollapsed } : {}; - return Object(external_wp_element_["createElement"])(UIComponent, Object(esm_extends["a" /* default */])({ - popoverProps: ui_POPOVER_PROPS, - icon: activeAlignmentControl ? activeAlignmentControl.icon : defaultAlignmentControl.icon, - label: Object(external_wp_i18n_["__"])('Align'), - toggleProps: { - describedBy: Object(external_wp_i18n_["__"])('Change alignment') - }, - controls: enabledControls.map(control => { + return (0,external_wp_element_namespaceObject.createElement)(UIComponent, _extends({ + popoverProps: POPOVER_PROPS, + icon: activeAlignment ? activeAlignment.icon : defaultAlignmentControl.icon, + label: (0,external_wp_i18n_namespaceObject._x)('Change vertical alignment', 'Block vertical alignment setting label'), + controls: controls.map(control => { return { ...BLOCK_ALIGNMENTS_CONTROLS[control], isActive: value === control, role: isCollapsed ? 'menuitemradio' : undefined, @@ -12882,29 +11127,1038 @@ }) }, extraProps)); } - -/* harmony default export */ var ui = (BlockAlignmentUI); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/index.js - - - -/** - * Internal dependencies - */ - -function BlockAlignmentControl(props) { - return Object(external_wp_element_["createElement"])(ui, Object(esm_extends["a" /* default */])({}, props, { +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-vertical-alignment-toolbar/README.md + */ + + +/* harmony default export */ var ui = (BlockVerticalAlignmentUI); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/index.js + + + +/** + * Internal dependencies + */ + + +const BlockVerticalAlignmentControl = props => { + return (0,external_wp_element_namespaceObject.createElement)(ui, _extends({}, props, { + isToolbar: false + })); +}; + +const BlockVerticalAlignmentToolbar = props => { + return (0,external_wp_element_namespaceObject.createElement)(ui, _extends({}, props, { + isToolbar: true + })); +}; +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-vertical-alignment-control/README.md + */ + + + + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/justify-content-control/ui.js + + + +/** + * WordPress dependencies + */ + + + +const icons = { + left: justify_left, + center: justify_center, + right: justify_right, + 'space-between': justify_space_between +}; + +function JustifyContentUI(_ref) { + let { + allowedControls = ['left', 'center', 'right', 'space-between'], + isCollapsed = true, + onChange, + value, + popoverProps, + isToolbar + } = _ref; + + // If the control is already selected we want a click + // again on the control to deselect the item, so we + // call onChange( undefined ) + const handleClick = next => { + if (next === value) { + onChange(undefined); + } else { + onChange(next); + } + }; + + const icon = value ? icons[value] : icons.left; + const allControls = [{ + name: 'left', + icon: justify_left, + title: (0,external_wp_i18n_namespaceObject.__)('Justify items left'), + isActive: 'left' === value, + onClick: () => handleClick('left') + }, { + name: 'center', + icon: justify_center, + title: (0,external_wp_i18n_namespaceObject.__)('Justify items center'), + isActive: 'center' === value, + onClick: () => handleClick('center') + }, { + name: 'right', + icon: justify_right, + title: (0,external_wp_i18n_namespaceObject.__)('Justify items right'), + isActive: 'right' === value, + onClick: () => handleClick('right') + }, { + name: 'space-between', + icon: justify_space_between, + title: (0,external_wp_i18n_namespaceObject.__)('Space between items'), + isActive: 'space-between' === value, + onClick: () => handleClick('space-between') + }]; + const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu; + const extraProps = isToolbar ? { + isCollapsed + } : {}; + return (0,external_wp_element_namespaceObject.createElement)(UIComponent, _extends({ + icon: icon, + popoverProps: popoverProps, + label: (0,external_wp_i18n_namespaceObject.__)('Change items justification'), + controls: allControls.filter(elem => allowedControls.includes(elem.name)) + }, extraProps)); +} + +/* harmony default export */ var justify_content_control_ui = (JustifyContentUI); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/justify-content-control/index.js + + + +/** + * Internal dependencies + */ + + +const JustifyContentControl = props => { + return (0,external_wp_element_namespaceObject.createElement)(justify_content_control_ui, _extends({}, props, { isToolbar: false })); -} -function BlockAlignmentToolbar(props) { - return Object(external_wp_element_["createElement"])(ui, Object(esm_extends["a" /* default */])({}, props, { +}; + +const JustifyToolbar = props => { + return (0,external_wp_element_namespaceObject.createElement)(justify_content_control_ui, _extends({}, props, { isToolbar: true })); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/align.js +}; +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/justify-content-control/README.md + */ + + + + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/layouts/flex.js + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + + + // Used with the default, horizontal flex orientation. + +const justifyContentMap = { + left: 'flex-start', + right: 'flex-end', + center: 'center', + 'space-between': 'space-between' +}; // Used with the vertical (column) flex orientation. + +const alignItemsMap = { + left: 'flex-start', + right: 'flex-end', + center: 'center' +}; +const verticalAlignmentMap = { + top: 'flex-start', + center: 'center', + bottom: 'flex-end' +}; +const flexWrapOptions = ['wrap', 'nowrap']; +/* harmony default export */ var flex = ({ + name: 'flex', + label: (0,external_wp_i18n_namespaceObject.__)('Flex'), + inspectorControls: function FlexLayoutInspectorControls(_ref) { + let { + layout = {}, + onChange, + layoutBlockSupport = {} + } = _ref; + const { + allowOrientation = true + } = layoutBlockSupport; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(FlexLayoutJustifyContentControl, { + layout: layout, + onChange: onChange + })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, allowOrientation && (0,external_wp_element_namespaceObject.createElement)(OrientationControl, { + layout: layout, + onChange: onChange + }))), (0,external_wp_element_namespaceObject.createElement)(FlexWrapControl, { + layout: layout, + onChange: onChange + })); + }, + toolBarControls: function FlexLayoutToolbarControls(_ref2) { + let { + layout = {}, + onChange, + layoutBlockSupport + } = _ref2; + + if (layoutBlockSupport !== null && layoutBlockSupport !== void 0 && layoutBlockSupport.allowSwitching) { + return null; + } + + const { + allowVerticalAlignment = true + } = layoutBlockSupport; + return (0,external_wp_element_namespaceObject.createElement)(block_controls, { + group: "block", + __experimentalShareWithChildBlocks: true + }, (0,external_wp_element_namespaceObject.createElement)(FlexLayoutJustifyContentControl, { + layout: layout, + onChange: onChange, + isToolbar: true + }), allowVerticalAlignment && (layout === null || layout === void 0 ? void 0 : layout.orientation) !== 'vertical' && (0,external_wp_element_namespaceObject.createElement)(FlexLayoutVerticalAlignmentControl, { + layout: layout, + onChange: onChange, + isToolbar: true + })); + }, + save: function FlexLayoutStyle(_ref3) { + var _style$spacing, _style$spacing2; + + let { + selector, + layout, + style, + blockName + } = _ref3; + const { + orientation = 'horizontal' + } = layout; + const blockGapSupport = useSetting('spacing.blockGap'); + const fallbackValue = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, ['spacing', 'blockGap', '__experimentalDefault']) || '0.5em'; + const hasBlockGapStylesSupport = blockGapSupport !== null; // If a block's block.json skips serialization for spacing or spacing.blockGap, + // don't apply the user-defined value to the styles. + + const blockGapValue = style !== null && style !== void 0 && (_style$spacing = style.spacing) !== null && _style$spacing !== void 0 && _style$spacing.blockGap && !shouldSkipSerialization(blockName, 'spacing', 'blockGap') ? getGapCSSValue(style === null || style === void 0 ? void 0 : (_style$spacing2 = style.spacing) === null || _style$spacing2 === void 0 ? void 0 : _style$spacing2.blockGap, fallbackValue) : `var( --wp--style--block-gap, ${fallbackValue} )`; + const justifyContent = justifyContentMap[layout.justifyContent] || justifyContentMap.left; + const flexWrap = flexWrapOptions.includes(layout.flexWrap) ? layout.flexWrap : 'wrap'; + const verticalAlignment = verticalAlignmentMap[layout.verticalAlignment] || verticalAlignmentMap.center; + const rowOrientation = ` + flex-direction: row; + align-items: ${verticalAlignment}; + justify-content: ${justifyContent}; + `; + const alignItems = alignItemsMap[layout.justifyContent] || alignItemsMap.left; + const columnOrientation = ` + flex-direction: column; + align-items: ${alignItems}; + `; + return (0,external_wp_element_namespaceObject.createElement)("style", null, ` + ${appendSelectors(selector)} { + display: flex; + flex-wrap: ${flexWrap}; + gap: ${hasBlockGapStylesSupport ? blockGapValue : fallbackValue}; + ${orientation === 'horizontal' ? rowOrientation : columnOrientation} + } + + ${appendSelectors(selector, '> *')} { + margin: 0; + } + `); + }, + + getOrientation(layout) { + const { + orientation = 'horizontal' + } = layout; + return orientation; + }, + + getAlignments() { + return []; + } + +}); + +function FlexLayoutVerticalAlignmentControl(_ref4) { + let { + layout, + onChange, + isToolbar = false + } = _ref4; + const { + verticalAlignment = verticalAlignmentMap.center + } = layout; + + const onVerticalAlignmentChange = value => { + onChange({ ...layout, + verticalAlignment: value + }); + }; + + if (isToolbar) { + return (0,external_wp_element_namespaceObject.createElement)(BlockVerticalAlignmentControl, { + onChange: onVerticalAlignmentChange, + value: verticalAlignment + }); + } + + const verticalAlignmentOptions = [{ + value: 'flex-start', + label: (0,external_wp_i18n_namespaceObject.__)('Align items top') + }, { + value: 'center', + label: (0,external_wp_i18n_namespaceObject.__)('Align items center') + }, { + value: 'flex-end', + label: (0,external_wp_i18n_namespaceObject.__)('Align items bottom') + }]; + return (0,external_wp_element_namespaceObject.createElement)("fieldset", { + className: "block-editor-hooks__flex-layout-vertical-alignment-control" + }, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_i18n_namespaceObject.__)('Vertical alignment')), (0,external_wp_element_namespaceObject.createElement)("div", null, verticalAlignmentOptions.map((value, icon, label) => { + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + key: value, + label: label, + icon: icon, + isPressed: verticalAlignment === value, + onClick: () => onVerticalAlignmentChange(value) + }); + }))); +} + +function FlexLayoutJustifyContentControl(_ref5) { + let { + layout, + onChange, + isToolbar = false + } = _ref5; + const { + justifyContent = 'left', + orientation = 'horizontal' + } = layout; + + const onJustificationChange = value => { + onChange({ ...layout, + justifyContent: value + }); + }; + + const allowedControls = ['left', 'center', 'right']; + + if (orientation === 'horizontal') { + allowedControls.push('space-between'); + } + + if (isToolbar) { + return (0,external_wp_element_namespaceObject.createElement)(JustifyContentControl, { + allowedControls: allowedControls, + value: justifyContent, + onChange: onJustificationChange, + popoverProps: { + position: 'bottom right', + isAlternate: true + } + }); + } + + const justificationOptions = [{ + value: 'left', + icon: justify_left, + label: (0,external_wp_i18n_namespaceObject.__)('Justify items left') + }, { + value: 'center', + icon: justify_center, + label: (0,external_wp_i18n_namespaceObject.__)('Justify items center') + }, { + value: 'right', + icon: justify_right, + label: (0,external_wp_i18n_namespaceObject.__)('Justify items right') + }]; + + if (orientation === 'horizontal') { + justificationOptions.push({ + value: 'space-between', + icon: justify_space_between, + label: (0,external_wp_i18n_namespaceObject.__)('Space between items') + }); + } + + return (0,external_wp_element_namespaceObject.createElement)("fieldset", { + className: "block-editor-hooks__flex-layout-justification-controls" + }, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_i18n_namespaceObject.__)('Justification')), (0,external_wp_element_namespaceObject.createElement)("div", null, justificationOptions.map(_ref6 => { + let { + value, + icon, + label + } = _ref6; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + key: value, + label: label, + icon: icon, + isPressed: justifyContent === value, + onClick: () => onJustificationChange(value) + }); + }))); +} + +function FlexWrapControl(_ref7) { + let { + layout, + onChange + } = _ref7; + const { + flexWrap = 'wrap' + } = layout; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Allow to wrap to multiple lines'), + onChange: value => { + onChange({ ...layout, + flexWrap: value ? 'wrap' : 'nowrap' + }); + }, + checked: flexWrap === 'wrap' + }); +} + +function OrientationControl(_ref8) { + let { + layout, + onChange + } = _ref8; + const { + orientation = 'horizontal' + } = layout; + return (0,external_wp_element_namespaceObject.createElement)("fieldset", { + className: "block-editor-hooks__flex-layout-orientation-controls" + }, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_i18n_namespaceObject.__)('Orientation')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + label: 'horizontal', + icon: arrow_right, + isPressed: orientation === 'horizontal', + onClick: () => onChange({ ...layout, + orientation: 'horizontal' + }) + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + label: 'vertical', + icon: arrow_down, + isPressed: orientation === 'vertical', + onClick: () => onChange({ ...layout, + orientation: 'vertical' + }) + })); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js +/** + * WordPress dependencies + */ + +/** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ + +/** + * Return an SVG icon. + * + * @param {IconProps} props icon is the SVG component to render + * size is a number specifiying the icon size in pixels + * Other props will be passed to wrapped SVG component + * + * @return {JSX.Element} Icon component + */ + +function Icon(_ref) { + let { + icon, + size = 24, + ...props + } = _ref; + return (0,external_wp_element_namespaceObject.cloneElement)(icon, { + width: size, + height: size, + ...props + }); +} + +/* harmony default export */ var build_module_icon = (Icon); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/layouts/flow.js + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + + +/* harmony default export */ var flow = ({ + name: 'default', + label: (0,external_wp_i18n_namespaceObject.__)('Flow'), + inspectorControls: function DefaultLayoutInspectorControls(_ref) { + let { + layout, + onChange + } = _ref; + const { + wideSize, + contentSize + } = layout; + const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ + availableUnits: useSetting('spacing.units') || ['%', 'px', 'em', 'rem', 'vw'] + }); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-hooks__layout-controls" + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-hooks__layout-controls-unit" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Content'), + labelPosition: "top", + __unstableInputWidth: "80px", + value: contentSize || wideSize || '', + onChange: nextWidth => { + nextWidth = 0 > parseFloat(nextWidth) ? '0' : nextWidth; + onChange({ ...layout, + contentSize: nextWidth + }); + }, + units: units + }), (0,external_wp_element_namespaceObject.createElement)(build_module_icon, { + icon: position_center + })), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-hooks__layout-controls-unit" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Wide'), + labelPosition: "top", + __unstableInputWidth: "80px", + value: wideSize || contentSize || '', + onChange: nextWidth => { + nextWidth = 0 > parseFloat(nextWidth) ? '0' : nextWidth; + onChange({ ...layout, + wideSize: nextWidth + }); + }, + units: units + }), (0,external_wp_element_namespaceObject.createElement)(build_module_icon, { + icon: stretch_wide + }))), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-hooks__layout-controls-reset" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + variant: "secondary", + isSmall: true, + disabled: !contentSize && !wideSize, + onClick: () => onChange({ + contentSize: undefined, + wideSize: undefined, + inherit: false + }) + }, (0,external_wp_i18n_namespaceObject.__)('Reset'))), (0,external_wp_element_namespaceObject.createElement)("p", { + className: "block-editor-hooks__layout-controls-helptext" + }, (0,external_wp_i18n_namespaceObject.__)('Customize the width for all elements that are assigned to the center or wide columns.'))); + }, + toolBarControls: function DefaultLayoutToolbarControls() { + return null; + }, + save: function DefaultLayoutStyle(_ref2) { + var _style$spacing; + + let { + selector, + layout = {}, + style, + blockName + } = _ref2; + const { + contentSize, + wideSize + } = layout; + const blockGapSupport = useSetting('spacing.blockGap'); + const hasBlockGapStylesSupport = blockGapSupport !== null; + const blockGapStyleValue = getGapBoxControlValueFromStyle(style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.blockGap); // If a block's block.json skips serialization for spacing or + // spacing.blockGap, don't apply the user-defined value to the styles. + + const blockGapValue = blockGapStyleValue !== null && blockGapStyleValue !== void 0 && blockGapStyleValue.top && !shouldSkipSerialization(blockName, 'spacing', 'blockGap') ? blockGapStyleValue === null || blockGapStyleValue === void 0 ? void 0 : blockGapStyleValue.top : 'var( --wp--style--block-gap )'; + let output = !!contentSize || !!wideSize ? ` + ${appendSelectors(selector, '> :where(:not(.alignleft):not(.alignright))')} { + max-width: ${contentSize !== null && contentSize !== void 0 ? contentSize : wideSize}; + margin-left: auto !important; + margin-right: auto !important; + } + ${appendSelectors(selector, '> .alignwide')} { + max-width: ${wideSize !== null && wideSize !== void 0 ? wideSize : contentSize}; + } + ${appendSelectors(selector, '> .alignfull')} { + max-width: none; + } + ` : ''; + output += ` + ${appendSelectors(selector, '> .alignleft')} { + float: left; + margin-inline-start: 0; + margin-inline-end: 2em; + } + ${appendSelectors(selector, '> .alignright')} { + float: right; + margin-inline-start: 2em; + margin-inline-end: 0; + } + + ${appendSelectors(selector, '> .aligncenter')} { + margin-left: auto !important; + margin-right: auto !important; + } + `; + + if (hasBlockGapStylesSupport) { + output += ` + ${appendSelectors(selector, '> *')} { + margin-block-start: 0; + margin-block-end: 0; + } + ${appendSelectors(selector, '> * + *')} { + margin-block-start: ${blockGapValue}; + } + `; + } + + return (0,external_wp_element_namespaceObject.createElement)("style", null, output); + }, + + getOrientation() { + return 'vertical'; + }, + + getAlignments(layout) { + const alignmentInfo = getAlignmentsInfo(layout); + + if (layout.alignments !== undefined) { + if (!layout.alignments.includes('none')) { + layout.alignments.unshift('none'); + } + + return layout.alignments.map(alignment => ({ + name: alignment, + info: alignmentInfo[alignment] + })); + } + + const { + contentSize, + wideSize + } = layout; + const alignments = [{ + name: 'left' + }, { + name: 'center' + }, { + name: 'right' + }]; + + if (contentSize) { + alignments.unshift({ + name: 'full' + }); + } + + if (wideSize) { + alignments.unshift({ + name: 'wide', + info: alignmentInfo.wide + }); + } + + alignments.unshift({ + name: 'none', + info: alignmentInfo.none + }); + return alignments; + } + +}); +/** + * Helper method to assign contextual info to clarify + * alignment settings. + * + * Besides checking if `contentSize` and `wideSize` have a + * value, we now show this information only if their values + * are not a `css var`. This needs to change when parsing + * css variables land. + * + * @see https://github.com/WordPress/gutenberg/pull/34710#issuecomment-918000752 + * + * @param {Object} layout The layout object. + * @return {Object} An object with contextual info per alignment. + */ + +function getAlignmentsInfo(layout) { + const { + contentSize, + wideSize + } = layout; + const alignmentInfo = {}; + const sizeRegex = /^(?!0)\d+(px|em|rem|vw|vh|%)?$/i; + + if (sizeRegex.test(contentSize)) { + // translators: %s: container size (i.e. 600px etc) + alignmentInfo.none = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Max %s wide'), contentSize); + } + + if (sizeRegex.test(wideSize)) { + // translators: %s: container size (i.e. 600px etc) + alignmentInfo.wide = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Max %s wide'), wideSize); + } + + return alignmentInfo; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/layouts/index.js +/** + * Internal dependencies + */ + + +const layoutTypes = [flow, flex]; +/** + * Retrieves a layout type by name. + * + * @param {string} name - The name of the layout type. + * @return {Object} Layout type. + */ + +function getLayoutType() { + let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default'; + return layoutTypes.find(layoutType => layoutType.name === name); +} +/** + * Retrieves the available layout types. + * + * @return {Array} Layout types. + */ + +function getLayoutTypes() { + return layoutTypes; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/layout.js + + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + +const defaultLayout = { + type: 'default' +}; +const Layout = (0,external_wp_element_namespaceObject.createContext)(defaultLayout); +/** + * Allows to define the layout. + */ + +const LayoutProvider = Layout.Provider; +/** + * React hook used to retrieve the layout config. + */ + +function useLayout() { + return (0,external_wp_element_namespaceObject.useContext)(Layout); +} +function LayoutStyle(_ref) { + let { + layout = {}, + ...props + } = _ref; + const layoutType = getLayoutType(layout.type); + + if (layoutType) { + return (0,external_wp_element_namespaceObject.createElement)(layoutType.save, _extends({ + layout: layout + }, props)); + } + + return null; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/use-available-alignments.js +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + + +const use_available_alignments_DEFAULT_CONTROLS = ['none', 'left', 'center', 'right', 'wide', 'full']; +const WIDE_CONTROLS = ['wide', 'full']; +function useAvailableAlignments() { + let controls = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : use_available_alignments_DEFAULT_CONTROLS; + + // Always add the `none` option if not exists. + if (!controls.includes('none')) { + controls = ['none', ...controls]; + } + + const { + wideControlsEnabled = false, + themeSupportsLayout + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getSettings + } = select(store); + const settings = getSettings(); + return { + wideControlsEnabled: settings.alignWide, + themeSupportsLayout: settings.supportsLayout + }; + }, []); + const layout = useLayout(); + const layoutType = getLayoutType(layout === null || layout === void 0 ? void 0 : layout.type); + const layoutAlignments = layoutType.getAlignments(layout); + + if (themeSupportsLayout) { + const alignments = layoutAlignments.filter(_ref => { + let { + name: alignmentName + } = _ref; + return controls.includes(alignmentName); + }); // While we treat `none` as an alignment, we shouldn't return it if no + // other alignments exist. + + if (alignments.length === 1 && alignments[0].name === 'none') { + return []; + } + + return alignments; + } // Starting here, it's the fallback for themes not supporting the layout config. + + + if (layoutType.name !== 'default') { + return []; + } + + const { + alignments: availableAlignments = use_available_alignments_DEFAULT_CONTROLS + } = layout; + const enabledControls = controls.filter(control => (layout.alignments || // Ignore the global wideAlignment check if the layout explicitely defines alignments. + wideControlsEnabled || !WIDE_CONTROLS.includes(control)) && availableAlignments.includes(control)).map(enabledControl => ({ + name: enabledControl + })); // While we treat `none` as an alignment, we shouldn't return it if no + // other alignments exist. + + if (enabledControls.length === 1 && enabledControls[0].name === 'none') { + return []; + } + + return enabledControls; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/ui.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + +const ui_BLOCK_ALIGNMENTS_CONTROLS = { + none: { + icon: align_none, + title: (0,external_wp_i18n_namespaceObject._x)('None', 'Alignment option') + }, + left: { + icon: position_left, + title: (0,external_wp_i18n_namespaceObject.__)('Align left') + }, + center: { + icon: position_center, + title: (0,external_wp_i18n_namespaceObject.__)('Align center') + }, + right: { + icon: position_right, + title: (0,external_wp_i18n_namespaceObject.__)('Align right') + }, + wide: { + icon: stretch_wide, + title: (0,external_wp_i18n_namespaceObject.__)('Wide width') + }, + full: { + icon: stretch_full_width, + title: (0,external_wp_i18n_namespaceObject.__)('Full width') + } +}; +const ui_DEFAULT_CONTROL = 'none'; +const ui_POPOVER_PROPS = { + isAlternate: true +}; + +function BlockAlignmentUI(_ref) { + let { + value, + onChange, + controls, + isToolbar, + isCollapsed = true + } = _ref; + const enabledControls = useAvailableAlignments(controls); + const hasEnabledControls = !!enabledControls.length; + + if (!hasEnabledControls) { + return null; + } + + function onChangeAlignment(align) { + onChange([value, 'none'].includes(align) ? undefined : align); + } + + const activeAlignmentControl = ui_BLOCK_ALIGNMENTS_CONTROLS[value]; + const defaultAlignmentControl = ui_BLOCK_ALIGNMENTS_CONTROLS[ui_DEFAULT_CONTROL]; + const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu; + const commonProps = { + popoverProps: ui_POPOVER_PROPS, + icon: activeAlignmentControl ? activeAlignmentControl.icon : defaultAlignmentControl.icon, + label: (0,external_wp_i18n_namespaceObject.__)('Align'), + toggleProps: { + describedBy: (0,external_wp_i18n_namespaceObject.__)('Change alignment') + } + }; + const extraProps = isToolbar || external_wp_element_namespaceObject.Platform.isNative ? { + isCollapsed: isToolbar ? isCollapsed : undefined, + controls: enabledControls.map(_ref2 => { + let { + name: controlName + } = _ref2; + return { ...ui_BLOCK_ALIGNMENTS_CONTROLS[controlName], + isActive: value === controlName || !value && controlName === 'none', + role: isCollapsed ? 'menuitemradio' : undefined, + onClick: () => onChangeAlignment(controlName) + }; + }) + } : { + children: _ref3 => { + let { + onClose + } = _ref3; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { + className: "block-editor-block-alignment-control__menu-group" + }, enabledControls.map(_ref4 => { + let { + name: controlName, + info + } = _ref4; + const { + icon, + title + } = ui_BLOCK_ALIGNMENTS_CONTROLS[controlName]; // If no value is provided, mark as selected the `none` option. + + const isSelected = controlName === value || !value && controlName === 'none'; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + key: controlName, + icon: icon, + iconPosition: "left", + className: classnames_default()('components-dropdown-menu__menu-item', { + 'is-active': isSelected + }), + isSelected: isSelected, + onClick: () => { + onChangeAlignment(controlName); + onClose(); + }, + role: "menuitemradio", + info: info + }, title); + }))); + } + }; + return (0,external_wp_element_namespaceObject.createElement)(UIComponent, _extends({}, commonProps, extraProps)); +} + +/* harmony default export */ var block_alignment_control_ui = (BlockAlignmentUI); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/index.js + + + +/** + * Internal dependencies + */ + + +const BlockAlignmentControl = props => { + return (0,external_wp_element_namespaceObject.createElement)(block_alignment_control_ui, _extends({}, props, { + isToolbar: false + })); +}; + +const BlockAlignmentToolbar = props => { + return (0,external_wp_element_namespaceObject.createElement)(block_alignment_control_ui, _extends({}, props, { + isToolbar: true + })); +}; +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-alignment-control/README.md + */ + + + + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/align.js @@ -12957,20 +12211,22 @@ * @return {string[]} Valid alignments. */ -function getValidAlignments(blockAlign, hasWideBlockSupport = true, hasWideEnabled = true) { +function getValidAlignments(blockAlign) { + let hasWideBlockSupport = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + let hasWideEnabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; let validAlignments; if (Array.isArray(blockAlign)) { validAlignments = ALL_ALIGNMENTS.filter(value => blockAlign.includes(value)); } else if (blockAlign === true) { // `true` includes all alignments... - validAlignments = ALL_ALIGNMENTS; + validAlignments = [...ALL_ALIGNMENTS]; } else { validAlignments = []; } if (!hasWideEnabled || blockAlign === true && !hasWideBlockSupport) { - return Object(external_lodash_["without"])(validAlignments, ...WIDE_ALIGNMENTS); + return (0,external_lodash_namespaceObject.without)(validAlignments, ...WIDE_ALIGNMENTS); } return validAlignments; @@ -12978,17 +12234,18 @@ /** * Filters registered block settings, extending attributes to include `align`. * - * @param {Object} settings Original block settings - * @return {Object} Filtered block settings + * @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'])) { + // Allow blocks to specify their own attribute definition with default values if needed. + if ((0,external_lodash_namespaceObject.has)(settings.attributes, ['align', 'type'])) { return settings; } - if (Object(external_wp_blocks_["hasBlockSupport"])(settings, 'align')) { + if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'align')) { // Gracefully handle if settings.attributes is undefined. settings.attributes = { ...settings.attributes, align: { @@ -13006,27 +12263,33 @@ * 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 - */ - -const withToolbarControls = Object(external_wp_compose_["createHigherOrderComponent"])(BlockEdit => props => { + * @param {Function} BlockEdit Original component. + * + * @return {Function} Wrapped component. + */ + +const withToolbarControls = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => { const { name: blockName - } = props; // Compute the block allowed alignments without taking into account, - // if the theme supports wide alignments or not - // and without checking the layout for availble alignments. - // BlockAlignmentToolbar takes both of these into account. - - const blockAllowedAlignments = getValidAlignments(Object(external_wp_blocks_["getBlockSupport"])(blockName, 'align'), Object(external_wp_blocks_["hasBlockSupport"])(blockName, 'alignWide', true)); - const validAlignments = useAvailableAlignments(blockAllowedAlignments); + } = props; // Compute the block valid alignments by taking into account, + // if the theme supports wide alignments or not and the layout's + // availble alignments. We do that for conditionally rendering + // Slot. + + const blockAllowedAlignments = getValidAlignments((0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, 'align'), (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'alignWide', true)); + const validAlignments = useAvailableAlignments(blockAllowedAlignments).map(_ref => { + let { + name + } = _ref; + return name; + }); const updateAlignment = nextAlign => { if (!nextAlign) { var _blockType$attributes, _blockType$attributes2; - const blockType = Object(external_wp_blocks_["getBlockType"])(props.name); - const blockDefaultAlign = (_blockType$attributes = blockType.attributes) === null || _blockType$attributes === void 0 ? void 0 : (_blockType$attributes2 = _blockType$attributes.align) === null || _blockType$attributes2 === void 0 ? void 0 : _blockType$attributes2.default; + const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(props.name); + const blockDefaultAlign = blockType === null || blockType === void 0 ? void 0 : (_blockType$attributes = blockType.attributes) === null || _blockType$attributes === void 0 ? void 0 : (_blockType$attributes2 = _blockType$attributes.align) === null || _blockType$attributes2 === void 0 ? void 0 : _blockType$attributes2.default; if (blockDefaultAlign) { nextAlign = ''; @@ -13038,25 +12301,24 @@ }); }; - return [validAlignments.length > 0 && props.isSelected && Object(external_wp_element_["createElement"])(block_controls, { - key: "align-controls", - group: "block" - }, Object(external_wp_element_["createElement"])(BlockAlignmentControl, { + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, !!validAlignments.length && (0,external_wp_element_namespaceObject.createElement)(block_controls, { + group: "block", + __experimentalShareWithChildBlocks: true + }, (0,external_wp_element_namespaceObject.createElement)(BlockAlignmentControl, { value: props.attributes.align, onChange: updateAlignment, controls: validAlignments - })), Object(external_wp_element_["createElement"])(BlockEdit, Object(esm_extends["a" /* default */])({ - key: "edit" - }, props))]; + })), (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props)); }, 'withToolbarControls'); /** * Override the default block element to add alignment wrapper props. * - * @param {Function} BlockListBlock Original component - * @return {Function} Wrapped component - */ - -const withDataAlign = Object(external_wp_compose_["createHigherOrderComponent"])(BlockListBlock => props => { + * @param {Function} BlockListBlock Original component. + * + * @return {Function} Wrapped component. + */ + +const withDataAlign = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockListBlock => props => { const { name, attributes @@ -13064,23 +12326,23 @@ const { align } = attributes; - const blockAllowedAlignments = getValidAlignments(Object(external_wp_blocks_["getBlockSupport"])(name, 'align'), Object(external_wp_blocks_["hasBlockSupport"])(name, 'alignWide', true)); + const blockAllowedAlignments = getValidAlignments((0,external_wp_blocks_namespaceObject.getBlockSupport)(name, 'align'), (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'alignWide', true)); const validAlignments = useAvailableAlignments(blockAllowedAlignments); // If an alignment is not assigned, there's no need to go through the // effort to validate or assign its value. if (align === undefined) { - return Object(external_wp_element_["createElement"])(BlockListBlock, props); + return (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, props); } let wrapperProps = props.wrapperProps; - if (validAlignments.includes(align)) { + if (validAlignments.some(alignment => alignment.name === align)) { wrapperProps = { ...wrapperProps, 'data-align': align }; } - return Object(external_wp_element_["createElement"])(BlockListBlock, Object(esm_extends["a" /* default */])({}, props, { + return (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, _extends({}, props, { wrapperProps: wrapperProps })); }); @@ -13088,18 +12350,19 @@ * 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 + * @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) { const { align } = attributes; - const blockAlign = Object(external_wp_blocks_["getBlockSupport"])(blockType, 'align'); - const hasWideBlockSupport = Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'alignWide', true); // Compute valid alignments without taking into account if + const blockAlign = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, 'align'); + const hasWideBlockSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'alignWide', true); // Compute valid alignments without taking into account if // the theme supports wide alignments or not. // This way changing themes does not impact the block save. @@ -13111,81 +12374,46 @@ return props; } -Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/align/addAttribute', addAttribute); -Object(external_wp_hooks_["addFilter"])('editor.BlockListBlock', 'core/editor/align/with-data-align', withDataAlign); -Object(external_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/editor/align/with-toolbar-controls', withToolbarControls); -Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/align/addAssignedAlign', addAssignedAlign); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-advanced-controls/index.js - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - -const inspector_advanced_controls_name = 'InspectorAdvancedControls'; -const { - Fill: inspector_advanced_controls_Fill, - Slot: inspector_advanced_controls_Slot -} = Object(external_wp_components_["createSlotFill"])(inspector_advanced_controls_name); - -function InspectorAdvancedControls({ - children -}) { - const { - isSelected - } = useBlockEditContext(); - return isSelected ? Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalStyleProvider"], { - document: document - }, Object(external_wp_element_["createElement"])(inspector_advanced_controls_Fill, null, children)) : null; -} - -InspectorAdvancedControls.slotName = inspector_advanced_controls_name; -InspectorAdvancedControls.Slot = inspector_advanced_controls_Slot; -/** - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inspector-advanced-controls/README.md - */ - -/* harmony default export */ var inspector_advanced_controls = (InspectorAdvancedControls); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/index.js - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - -const { - Fill: inspector_controls_Fill, - Slot: inspector_controls_Slot -} = Object(external_wp_components_["createSlotFill"])('InspectorControls'); - -function InspectorControls({ - children -}) { - return useDisplayBlockControls() ? Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalStyleProvider"], { - document: document - }, Object(external_wp_element_["createElement"])(inspector_controls_Fill, null, children)) : null; -} - -InspectorControls.Slot = inspector_controls_Slot; -/** - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inspector-controls/README.md - */ - -/* harmony default export */ var inspector_controls = (InspectorControls); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/anchor.js +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/align/addAttribute', addAttribute); +(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/editor/align/with-data-align', withDataAlign); +(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/editor/align/with-toolbar-controls', withToolbarControls); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/align/addAssignedAlign', addAssignedAlign); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/lock.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +/** + * Filters registered block settings, extending attributes to include `lock`. + * + * @param {Object} settings Original block settings. + * + * @return {Object} Filtered block settings. + */ + +function lock_addAttribute(settings) { + // Allow blocks to specify their own attribute definition with default values if needed. + if ((0,external_lodash_namespaceObject.has)(settings.attributes, ['lock', 'type'])) { + return settings; + } // Gracefully handle if settings.attributes is undefined. + + + settings.attributes = { ...settings.attributes, + lock: { + type: 'object' + } + }; + return settings; +} +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/lock/addAttribute', lock_addAttribute); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/anchor.js /** @@ -13214,6 +12442,12 @@ */ const ANCHOR_REGEX = /[\s#]/g; +const ANCHOR_SCHEMA = { + type: 'string', + source: 'attribute', + attribute: 'id', + selector: '*' +}; /** * Filters registered block settings, extending attributes with anchor using ID * of the first node. @@ -13224,20 +12458,15 @@ */ function anchor_addAttribute(settings) { - // allow blocks to specify their own attribute definition with default values if needed. - if (Object(external_lodash_["has"])(settings.attributes, ['anchor', 'type'])) { + // Allow blocks to specify their own attribute definition with default values if needed. + if ((0,external_lodash_namespaceObject.has)(settings.attributes, ['anchor', 'type'])) { return settings; } - if (Object(external_wp_blocks_["hasBlockSupport"])(settings, 'anchor')) { + if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'anchor')) { // Gracefully handle if settings.attributes is undefined. settings.attributes = { ...settings.attributes, - anchor: { - type: 'string', - source: 'attribute', - attribute: 'id', - selector: '*' - } + anchor: ANCHOR_SCHEMA }; } @@ -13252,20 +12481,20 @@ * @return {WPComponent} Wrapped component. */ -const withInspectorControl = Object(external_wp_compose_["createHigherOrderComponent"])(BlockEdit => { +const withInspectorControl = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => { return props => { - const hasAnchor = Object(external_wp_blocks_["hasBlockSupport"])(props.name, 'anchor'); + const hasAnchor = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(props.name, 'anchor'); if (hasAnchor && props.isSelected) { - const isWeb = external_wp_element_["Platform"].OS === 'web'; - const textControl = Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { + const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web'; + const textControl = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { className: "html-anchor-control", - label: Object(external_wp_i18n_["__"])('HTML anchor'), - help: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_i18n_["__"])('Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.'), Object(external_wp_element_["createElement"])(external_wp_components_["ExternalLink"], { - href: 'https://wordpress.org/support/article/page-jumps/' - }, Object(external_wp_i18n_["__"])('Learn more about anchors'))), + label: (0,external_wp_i18n_namespaceObject.__)('HTML anchor'), + help: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.'), isWeb && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { + href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/page-jumps/') + }, (0,external_wp_i18n_namespaceObject.__)('Learn more about anchors'))), value: props.attributes.anchor || '', - placeholder: !isWeb ? Object(external_wp_i18n_["__"])('Add an anchor') : null, + placeholder: !isWeb ? (0,external_wp_i18n_namespaceObject.__)('Add an anchor') : null, onChange: nextValue => { nextValue = nextValue.replace(ANCHOR_REGEX, '-'); props.setAttributes({ @@ -13275,12 +12504,14 @@ autoCapitalize: "none", autoComplete: "off" }); - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(BlockEdit, props), isWeb && Object(external_wp_element_["createElement"])(inspector_advanced_controls, null, textControl), !isWeb && props.name === 'core/heading' && Object(external_wp_element_["createElement"])(inspector_controls, null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { - title: Object(external_wp_i18n_["__"])('Heading settings') + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props), isWeb && (0,external_wp_element_namespaceObject.createElement)(inspector_controls, { + __experimentalGroup: "advanced" + }, textControl), !isWeb && props.name === 'core/heading' && (0,external_wp_element_namespaceObject.createElement)(inspector_controls, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { + title: (0,external_wp_i18n_namespaceObject.__)('Heading settings') }, textControl))); } - return Object(external_wp_element_["createElement"])(BlockEdit, props); + return (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props); }; }, 'withInspectorControl'); /** @@ -13296,23 +12527,22 @@ */ function addSaveProps(extraProps, blockType, attributes) { - if (Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'anchor')) { + if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'anchor')) { extraProps.id = attributes.anchor === '' ? null : attributes.anchor; } return extraProps; } -Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/anchor/attribute', anchor_addAttribute); -Object(external_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/editor/anchor/with-inspector-control', withInspectorControl); -Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/anchor/save-props', addSaveProps); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/custom-class-name.js - - -/** - * External dependencies - */ - +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/anchor/attribute', anchor_addAttribute); +(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/editor/anchor/with-inspector-control', withInspectorControl); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/anchor/save-props', addSaveProps); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/custom-class-name.js + + +/** + * External dependencies + */ /** * WordPress dependencies @@ -13338,7 +12568,7 @@ */ function custom_class_name_addAttribute(settings) { - if (Object(external_wp_blocks_["hasBlockSupport"])(settings, 'customClassName', true)) { + if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'customClassName', true)) { // Gracefully handle if settings.attributes is undefined. settings.attributes = { ...settings.attributes, className: { @@ -13358,25 +12588,27 @@ * @return {WPComponent} Wrapped component. */ -const custom_class_name_withInspectorControl = Object(external_wp_compose_["createHigherOrderComponent"])(BlockEdit => { +const custom_class_name_withInspectorControl = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => { return props => { - const hasCustomClassName = Object(external_wp_blocks_["hasBlockSupport"])(props.name, 'customClassName', true); + const hasCustomClassName = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(props.name, 'customClassName', true); if (hasCustomClassName && props.isSelected) { - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(BlockEdit, props), Object(external_wp_element_["createElement"])(inspector_advanced_controls, null, Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props), (0,external_wp_element_namespaceObject.createElement)(inspector_controls, { + __experimentalGroup: "advanced" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { autoComplete: "off", - label: Object(external_wp_i18n_["__"])('Additional CSS class(es)'), + label: (0,external_wp_i18n_namespaceObject.__)('Additional CSS class(es)'), value: props.attributes.className || '', onChange: nextValue => { props.setAttributes({ className: nextValue !== '' ? nextValue : undefined }); }, - help: Object(external_wp_i18n_["__"])('Separate multiple classes with spaces.') + help: (0,external_wp_i18n_namespaceObject.__)('Separate multiple classes with spaces.') }))); } - return Object(external_wp_element_["createElement"])(BlockEdit, props); + return (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props); }; }, 'withInspectorControl'); /** @@ -13392,71 +12624,55 @@ */ function custom_class_name_addSaveProps(extraProps, blockType, attributes) { - if (Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'customClassName', true) && attributes.className) { + if ((0,external_wp_blocks_namespaceObject.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 = `
${innerHTML}
`; - const parsed = Object(external_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_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. - const attributesSansClassName = Object(external_lodash_["omit"])(blockAttributes, ['className']); - const serialized = Object(external_wp_blocks_["getSaveContent"])(blockType, attributesSansClassName); - const defaultClasses = getHTMLRootElementClasses(serialized); - const actualClasses = getHTMLRootElementClasses(innerHTML); - const customClasses = Object(external_lodash_["difference"])(actualClasses, defaultClasses); - - if (customClasses.length) { - blockAttributes.className = customClasses.join(' '); - } else if (serialized) { - delete blockAttributes.className; - } - } - - return blockAttributes; -} -Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/custom-class-name/attribute', custom_class_name_addAttribute); -Object(external_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/editor/custom-class-name/with-inspector-control', custom_class_name_withInspectorControl); -Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/custom-class-name/save-props', custom_class_name_addSaveProps); -Object(external_wp_hooks_["addFilter"])('blocks.getBlockAttributes', 'core/custom-class-name/addParsedDifference', addParsedDifference); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/generated-class-name.js +function addTransforms(result, source, index, results) { + if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(result.name, 'customClassName', true)) { + return result; + } // If the condition verifies we are probably in the presence of a wrapping transform + // e.g: nesting paragraphs in a group or columns and in that case the class should not be kept. + + + if (results.length === 1 && result.innerBlocks.length === source.length) { + return result; + } // If we are transforming one block to multiple blocks or multiple blocks to one block, + // we ignore the class during the transform. + + + if (results.length === 1 && source.length > 1 || results.length > 1 && source.length === 1) { + return result; + } // If we are in presence of transform between one or more block in the source + // that have one or more blocks in the result + // we apply the class on source N to the result N, + // if source N does not exists we do nothing. + + + if (source[index]) { + var _source$index; + + const originClassName = (_source$index = source[index]) === null || _source$index === void 0 ? void 0 : _source$index.attributes.className; + + if (originClassName) { + return { ...result, + attributes: { ...result.attributes, + className: originClassName + } + }; + } + } + + return result; +} +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/custom-class-name/attribute', custom_class_name_addAttribute); +(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/editor/custom-class-name/with-inspector-control', custom_class_name_withInspectorControl); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/custom-class-name/save-props', custom_class_name_addSaveProps); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.switchToBlockType.transformedBlock', 'core/color/addTransforms', addTransforms); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/generated-class-name.js /** * External dependencies */ @@ -13479,5852 +12695,149 @@ */ function addGeneratedClassName(extraProps, blockType) { - // Adding the generated className - if (Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'className', true)) { + // Adding the generated className. + if ((0,external_wp_blocks_namespaceObject.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_wp_blocks_["getBlockDefaultClassName"])(blockType.name), ...extraProps.className.split(' ')]).join(' ').trim(); + // We use uniq to prevent duplicate classnames. + extraProps.className = (0,external_lodash_namespaceObject.uniq)([(0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockType.name), ...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_wp_blocks_["getBlockDefaultClassName"])(blockType.name); + // so we just dump the default name in there. + extraProps.className = (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockType.name); } } return extraProps; } -Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/generated-class-name/save-props', addGeneratedClassName); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-setting/index.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - - -const deprecatedFlags = { - 'color.palette': settings => settings.colors === undefined ? undefined : settings.colors, - 'color.gradients': settings => settings.gradients === undefined ? undefined : settings.gradients, - 'color.custom': settings => settings.disableCustomColors === undefined ? undefined : !settings.disableCustomColors, - 'color.customGradient': settings => settings.disableCustomGradients === undefined ? undefined : !settings.disableCustomGradients, - 'typography.fontSizes': settings => settings.fontSizes === undefined ? undefined : settings.fontSizes, - 'typography.customFontSize': settings => settings.disableCustomFontSizes === undefined ? undefined : !settings.disableCustomFontSizes, - 'typography.customLineHeight': settings => settings.enableCustomLineHeight, - 'spacing.units': settings => { - if (settings.enableCustomUnits === undefined) { - return; - } - - if (settings.enableCustomUnits === true) { - return ['px', 'em', 'rem', 'vh', 'vw', '%']; - } - - return settings.enableCustomUnits; - }, - 'spacing.customPadding': settings => settings.enableCustomSpacing -}; -const PATHS_WITH_MERGE = { - 'color.gradients': true, - 'color.palette': true, - 'typography.fontFamilies': true, - 'typography.fontSizes': true -}; -/** - * Hook that retrieves the editor setting. - * It works with nested objects using by finding the value at path. - * - * @param {string} path The path to the setting. - * - * @return {any} Returns the value defined for the setting. - * - * @example - * ```js - * const isEnabled = useSetting( 'typography.dropCap' ); - * ``` - */ - -function useSetting(path) { - const { - name: blockName - } = useBlockEditContext(); - const setting = Object(external_wp_data_["useSelect"])(select => { - var _get; - - const settings = select(store).getSettings(); // 1 - Use __experimental features, if available. - // We cascade to the all value if the block one is not available. - - const defaultsPath = `__experimentalFeatures.${path}`; - const blockPath = `__experimentalFeatures.blocks.${blockName}.${path}`; - const experimentalFeaturesResult = (_get = Object(external_lodash_["get"])(settings, blockPath)) !== null && _get !== void 0 ? _get : Object(external_lodash_["get"])(settings, defaultsPath); - - if (experimentalFeaturesResult !== undefined) { - if (PATHS_WITH_MERGE[path]) { - var _ref, _experimentalFeatures; - - return (_ref = (_experimentalFeatures = experimentalFeaturesResult.user) !== null && _experimentalFeatures !== void 0 ? _experimentalFeatures : experimentalFeaturesResult.theme) !== null && _ref !== void 0 ? _ref : experimentalFeaturesResult.core; - } - - return experimentalFeaturesResult; - } // 2 - Use deprecated settings, otherwise. - - - const deprecatedSettingsValue = deprecatedFlags[path] ? deprecatedFlags[path](settings) : undefined; - - if (deprecatedSettingsValue !== undefined) { - return deprecatedSettingsValue; - } // 3 - Fall back for typography.dropCap: - // This is only necessary to support typography.dropCap. - // when __experimentalFeatures are not present (core without plugin). - // To remove when __experimentalFeatures are ported to core. - - - return path === 'typography.dropCap' ? true : undefined; - }, [blockName, path]); - return setting; -} - -// EXTERNAL MODULE: ./node_modules/tinycolor2/tinycolor.js -var tinycolor = __webpack_require__("Zss7"); -var tinycolor_default = /*#__PURE__*/__webpack_require__.n(tinycolor); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-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 {?Object} 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. - */ - -const getColorObjectByAttributeValues = (colors, definedColor, customColor) => { - if (definedColor) { - const 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 {?Object} Color object included in the colors array whose color property equals colorValue. - * Returns undefined if no color object matches this requirement. - */ - -const 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. - * Returns undefined if either colorContextName or colorSlug are not provided. - */ - -function getColorClassName(colorContextName, colorSlug) { - if (!colorContextName || !colorSlug) { - return undefined; - } - - return `has-${Object(external_lodash_["kebabCase"])(colorSlug)}-${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 getMostReadableColor(colors, colorValue) { - return tinycolor_default.a.mostReadable(colorValue, Object(external_lodash_["map"])(colors, 'color')).toHexString(); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/gradients/use-gradient.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - - -const use_gradient_EMPTY_ARRAY = []; -function __experimentalGetGradientClass(gradientSlug) { - if (!gradientSlug) { - return undefined; - } - - return `has-${gradientSlug}-gradient-background`; -} -/** - * Retrieves the gradient value per slug. - * - * @param {Array} gradients Gradient Palette - * @param {string} slug Gradient slug - * - * @return {string} Gradient value. - */ - -function getGradientValueBySlug(gradients, slug) { - const gradient = Object(external_lodash_["find"])(gradients, ['slug', slug]); - return gradient && gradient.gradient; -} -function __experimentalGetGradientObjectByGradientValue(gradients, value) { - const gradient = Object(external_lodash_["find"])(gradients, ['gradient', value]); - return gradient; -} -/** - * Retrieves the gradient slug per slug. - * - * @param {Array} gradients Gradient Palette - * @param {string} value Gradient value - * @return {string} Gradient slug. - */ - -function getGradientSlugByValue(gradients, value) { - const gradient = __experimentalGetGradientObjectByGradientValue(gradients, value); - - return gradient && gradient.slug; -} -function __experimentalUseGradient({ - gradientAttribute = 'gradient', - customGradientAttribute = 'customGradient' -} = {}) { - const { - clientId - } = useBlockEditContext(); - const gradients = useSetting('color.gradients') || use_gradient_EMPTY_ARRAY; - const { - gradient, - customGradient - } = Object(external_wp_data_["useSelect"])(select => { - const { - getBlockAttributes - } = select(store); - const attributes = getBlockAttributes(clientId) || {}; - return { - customGradient: attributes[customGradientAttribute], - gradient: attributes[gradientAttribute] - }; - }, [clientId, gradientAttribute, customGradientAttribute]); - const { - updateBlockAttributes - } = Object(external_wp_data_["useDispatch"])(store); - const setGradient = Object(external_wp_element_["useCallback"])(newGradientValue => { - const slug = getGradientSlugByValue(gradients, newGradientValue); - - if (slug) { - updateBlockAttributes(clientId, { - [gradientAttribute]: slug, - [customGradientAttribute]: undefined - }); - return; - } - - updateBlockAttributes(clientId, { - [gradientAttribute]: undefined, - [customGradientAttribute]: newGradientValue - }); - }, [gradients, clientId, updateBlockAttributes]); - - const gradientClass = __experimentalGetGradientClass(gradient); - - let gradientValue; - - if (gradient) { - gradientValue = getGradientValueBySlug(gradients, gradient); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/generated-class-name/save-props', addGeneratedClassName); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/style-engine/build-module/styles/utils.js +/** + * External dependencies + */ + +/** + * Internal dependencies + */ + +function generateBoxRules(style, options, path, ruleKey) { + const boxStyle = (0,external_lodash_namespaceObject.get)(style, path); + + if (!boxStyle) { + return []; + } + + const rules = []; + + if (typeof boxStyle === 'string') { + rules.push({ + selector: options.selector, + key: ruleKey, + value: boxStyle + }); } else { - gradientValue = customGradient; - } - - return { - gradientClass, - gradientValue, - setGradient - }; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/control.js - - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - // translators: first %s: the color name or value (e.g. red or #ff0000) - -const colorIndicatorAriaLabel = Object(external_wp_i18n_["__"])('(Color: %s)'); // translators: first %s: the gradient name or value (e.g. red to green or linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%) - - -const gradientIndicatorAriaLabel = Object(external_wp_i18n_["__"])('(Gradient: %s)'); - -const colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients']; - -function VisualLabel({ - colors, - gradients, - label, - currentTab, - colorValue, - gradientValue -}) { - let value, ariaLabel; - - if (currentTab === 'color') { - if (colorValue) { - value = colorValue; - const colorObject = getColorObjectByColorValue(colors, value); - const colorName = colorObject && colorObject.name; - ariaLabel = Object(external_wp_i18n_["sprintf"])(colorIndicatorAriaLabel, colorName || value); - } - } else if (currentTab === 'gradient' && gradientValue) { - value = gradientValue; - - const gradientObject = __experimentalGetGradientObjectByGradientValue(gradients, value); - - const gradientName = gradientObject && gradientObject.name; - ariaLabel = Object(external_wp_i18n_["sprintf"])(gradientIndicatorAriaLabel, gradientName || value); - } - - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, label, !!value && Object(external_wp_element_["createElement"])(external_wp_components_["ColorIndicator"], { - colorValue: value, - "aria-label": ariaLabel - })); -} - -function ColorGradientControlInner({ - colors, - gradients, - disableCustomColors, - disableCustomGradients, - className, - label, - onColorChange, - onGradientChange, - colorValue, - gradientValue, - clearable -}) { - const canChooseAColor = onColorChange && (!Object(external_lodash_["isEmpty"])(colors) || !disableCustomColors); - const canChooseAGradient = onGradientChange && (!Object(external_lodash_["isEmpty"])(gradients) || !disableCustomGradients); - const [currentTab, setCurrentTab] = Object(external_wp_element_["useState"])(gradientValue ? 'gradient' : !!canChooseAColor && 'color'); - - if (!canChooseAColor && !canChooseAGradient) { - return null; - } - - return Object(external_wp_element_["createElement"])(external_wp_components_["BaseControl"], { - className: classnames_default()('block-editor-color-gradient-control', className) - }, Object(external_wp_element_["createElement"])("fieldset", null, Object(external_wp_element_["createElement"])("legend", null, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-color-gradient-control__color-indicator" - }, Object(external_wp_element_["createElement"])(external_wp_components_["BaseControl"].VisualLabel, null, Object(external_wp_element_["createElement"])(VisualLabel, { - currentTab: currentTab, - label: label, - colorValue: colorValue, - gradientValue: gradientValue - })))), canChooseAColor && canChooseAGradient && Object(external_wp_element_["createElement"])(external_wp_components_["ButtonGroup"], { - className: "block-editor-color-gradient-control__button-tabs" - }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - isSmall: true, - isPressed: currentTab === 'color', - onClick: () => setCurrentTab('color') - }, Object(external_wp_i18n_["__"])('Solid')), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - isSmall: true, - isPressed: currentTab === 'gradient', - onClick: () => setCurrentTab('gradient') - }, Object(external_wp_i18n_["__"])('Gradient'))), (currentTab === 'color' || !canChooseAGradient) && Object(external_wp_element_["createElement"])(external_wp_components_["ColorPalette"], { - value: colorValue, - onChange: canChooseAGradient ? newColor => { - onColorChange(newColor); - onGradientChange(); - } : onColorChange, - colors, - disableCustomColors, - clearable: clearable - }), (currentTab === 'gradient' || !canChooseAColor) && Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalGradientPicker"], { - value: gradientValue, - onChange: canChooseAColor ? newGradient => { - onGradientChange(newGradient); - onColorChange(); - } : onGradientChange, - gradients, - disableCustomGradients, - clearable: clearable - }))); -} - -function ColorGradientControlSelect(props) { - const colorGradientSettings = {}; - colorGradientSettings.colors = useSetting('color.palette'); - colorGradientSettings.gradients = useSetting('color.gradients'); - colorGradientSettings.disableCustomColors = !useSetting('color.custom'); - colorGradientSettings.disableCustomGradients = !useSetting('color.customGradient'); - return Object(external_wp_element_["createElement"])(ColorGradientControlInner, Object(esm_extends["a" /* default */])({}, colorGradientSettings, props)); -} - -function ColorGradientControl(props) { - if (Object(external_lodash_["every"])(colorsAndGradientKeys, key => props.hasOwnProperty(key))) { - return Object(external_wp_element_["createElement"])(ColorGradientControlInner, props); - } - - return Object(external_wp_element_["createElement"])(ColorGradientControlSelect, props); -} - -/* harmony default export */ var control = (ColorGradientControl); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/utils.js -/** - * External dependencies - */ - -/** - * Removed falsy values from nested object. - * - * @param {*} object - * @return {*} Object cleaned from falsy values - */ - -const cleanEmptyObject = object => { - if (!Object(external_lodash_["isObject"])(object) || Array.isArray(object)) { - return object; - } - - const cleanedNestedObjects = Object(external_lodash_["pickBy"])(Object(external_lodash_["mapValues"])(object, cleanEmptyObject), external_lodash_["identity"]); - return Object(external_lodash_["isEmpty"])(cleanedNestedObjects) ? undefined : cleanedNestedObjects; -}; - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/border-color.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - - - // Defining empty array here instead of inline avoids unnecessary re-renders of -// color control. - -const border_color_EMPTY_ARRAY = []; -/** - * Inspector control panel containing the border color related configuration. - * - * There is deliberate overlap between the colors and borders block supports - * relating to border color. It can be argued the border color controls could - * be included within either, or both, the colors and borders panels in the - * inspector controls. If they share the same block attributes it should not - * matter. - * - * @param {Object} props Block properties. - * @return {WPElement} Border color edit element. - */ - -function BorderColorEdit(props) { - var _style$border; - - const { - attributes: { - borderColor, - style - }, - setAttributes - } = props; - const colors = useSetting('color.palette') || border_color_EMPTY_ARRAY; - const disableCustomColors = !useSetting('color.custom'); - const disableCustomGradients = !useSetting('color.customGradient'); - - const onChangeColor = value => { - const colorObject = getColorObjectByColorValue(colors, value); - const newStyle = { ...style, - border: { ...(style === null || style === void 0 ? void 0 : style.border), - color: colorObject !== null && colorObject !== void 0 && colorObject.slug ? undefined : value - } - }; // If empty slug, ensure undefined to remove attribute. - - const newNamedColor = colorObject !== null && colorObject !== void 0 && colorObject.slug ? colorObject.slug : undefined; - setAttributes({ - style: cleanEmptyObject(newStyle), - borderColor: newNamedColor - }); - }; - - return Object(external_wp_element_["createElement"])(control, { - label: Object(external_wp_i18n_["__"])('Border color'), - value: borderColor || (style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.color), - colors: colors, - gradients: undefined, - disableCustomColors: disableCustomColors, - disableCustomGradients: disableCustomGradients, - onColorChange: onChangeColor - }); -} -/** - * Filters registered block settings, extending attributes to include - * `borderColor` if needed. - * - * @param {Object} settings Original block settings. - * @return {Object} Updated block settings. - */ - -function addAttributes(settings) { - if (!hasBorderSupport(settings, 'color')) { - return settings; - } // Allow blocks to specify default value if needed. - - - if (settings.attributes.borderColor) { - return settings; - } // Add new borderColor attribute to block settings. - - - return { ...settings, - attributes: { ...settings.attributes, - borderColor: { - type: 'string' - } - } - }; -} -/** - * Override props assigned to save component to inject border color. - * - * @param {Object} props Additional props applied to save element. - * @param {Object} blockType Block type definition. - * @param {Object} attributes Block's attributes - * @return {Object} Filtered props to apply to save element. - */ - - -function border_color_addSaveProps(props, blockType, attributes) { - var _style$border2; - - if (!hasBorderSupport(blockType, 'color') || shouldSkipSerialization(blockType)) { - return props; - } - - const { - borderColor, - style - } = attributes; - const borderColorClass = getColorClassName('border-color', borderColor); - const newClassName = classnames_default()(props.className, { - 'has-border-color': borderColor || (style === null || style === void 0 ? void 0 : (_style$border2 = style.border) === null || _style$border2 === void 0 ? void 0 : _style$border2.color), - [borderColorClass]: !!borderColorClass - }); // If we are clearing the last of the previous classes in `className` - // set it to `undefined` to avoid rendering empty DOM attributes. - - props.className = newClassName ? newClassName : undefined; - return props; -} -/** - * Filters the registered block settings to apply border color styles and - * classnames to the block edit wrapper. - * - * @param {Object} settings Original block settings. - * @return {Object} Filtered block settings. - */ - - -function addEditProps(settings) { - if (!hasBorderSupport(settings, 'color') || shouldSkipSerialization(settings)) { - return settings; - } - - const existingGetEditWrapperProps = settings.getEditWrapperProps; - - settings.getEditWrapperProps = attributes => { - let props = {}; - - if (existingGetEditWrapperProps) { - props = existingGetEditWrapperProps(attributes); - } - - return border_color_addSaveProps(props, settings, attributes); - }; - - return settings; -} -/** - * This adds inline styles for color palette colors. - * Ideally, this is not needed and themes should load their palettes on the editor. - * - * @param {Function} BlockListBlock Original component - * @return {Function} Wrapped component - */ - - -const withBorderColorPaletteStyles = Object(external_wp_compose_["createHigherOrderComponent"])(BlockListBlock => props => { - var _getColorObjectByAttr, _props$wrapperProps; - - const { - name, - attributes - } = props; - const { - borderColor - } = attributes; - const colors = useSetting('color.palette') || border_color_EMPTY_ARRAY; - - if (!hasBorderSupport(name, 'color') || shouldSkipSerialization(name)) { - return Object(external_wp_element_["createElement"])(BlockListBlock, props); - } - - const extraStyles = { - borderColor: borderColor ? (_getColorObjectByAttr = getColorObjectByAttributeValues(colors, borderColor)) === null || _getColorObjectByAttr === void 0 ? void 0 : _getColorObjectByAttr.color : undefined - }; - let wrapperProps = props.wrapperProps; - wrapperProps = { ...props.wrapperProps, - style: { ...extraStyles, - ...((_props$wrapperProps = props.wrapperProps) === null || _props$wrapperProps === void 0 ? void 0 : _props$wrapperProps.style) - } - }; - return Object(external_wp_element_["createElement"])(BlockListBlock, Object(esm_extends["a" /* default */])({}, props, { - wrapperProps: wrapperProps - })); -}); -Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/border/addAttributes', addAttributes); -Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/border/addSaveProps', border_color_addSaveProps); -Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/border/addEditProps', addEditProps); -Object(external_wp_hooks_["addFilter"])('editor.BlockListBlock', 'core/border/with-border-color-palette-styles', withBorderColorPaletteStyles); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/border-radius.js - - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -const MIN_BORDER_RADIUS_VALUE = 0; -const MAX_BORDER_RADIUS_VALUE = 50; -/** - * Inspector control panel containing the border radius related configuration. - * - * @param {Object} props Block properties. - * @return {WPElement} Border radius edit element. - */ - -function BorderRadiusEdit(props) { - var _style$border; - - const { - attributes: { - style - }, - setAttributes - } = props; - - const onChange = newRadius => { - let newStyle = { ...style, - border: { ...(style === null || style === void 0 ? void 0 : style.border), - radius: newRadius - } - }; - - if (newRadius === undefined) { - newStyle = cleanEmptyObject(newStyle); - } - - setAttributes({ - style: newStyle - }); - }; - - return Object(external_wp_element_["createElement"])(external_wp_components_["RangeControl"], { - value: style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.radius, - label: Object(external_wp_i18n_["__"])('Border radius'), - min: MIN_BORDER_RADIUS_VALUE, - max: MAX_BORDER_RADIUS_VALUE, - initialPosition: 0, - allowReset: true, - onChange: onChange - }); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/border-style-control/index.js - - -/** - * WordPress dependencies - */ - - -const DEFAULT_STYLE = { - key: 'default', - name: Object(external_wp_i18n_["__"])('Default'), - style: { - borderStyle: undefined - } -}; -const BORDER_STYLES = [DEFAULT_STYLE, { - key: 'none', - name: Object(external_wp_i18n_["__"])('None'), - style: { - borderStyle: 'none' - } -}, { - key: 'solid', - name: Object(external_wp_i18n_["__"])('Solid'), - style: { - borderStyle: 'solid' - } -}, { - key: 'dashed', - name: Object(external_wp_i18n_["__"])('Dashed'), - style: { - borderStyle: 'dashed' - } -}, { - key: 'dotted', - name: Object(external_wp_i18n_["__"])('Dotted'), - style: { - borderStyle: 'dotted' - } -}]; -/** - * Control to display border style options. - * - * @param {Object} props Component props. - * @param {Object} props.onChange Handler for changing border style selection. - * @param {Object} props.value Currently selected border style value. - * - * @return {WPElement} Custom border style select control. - */ - -function BorderStyleControl({ - onChange, - value -}) { - const style = BORDER_STYLES.find(option => option.key === value); - return Object(external_wp_element_["createElement"])("fieldset", { - className: "components-border-style-control" - }, Object(external_wp_element_["createElement"])(external_wp_components_["CustomSelectControl"], { - className: "components-border-style-control__select", - label: Object(external_wp_i18n_["__"])('Border style'), - options: BORDER_STYLES, - value: style || DEFAULT_STYLE, - onChange: ({ - selectedItem - }) => selectedItem.key === 'default' ? onChange(undefined) : onChange(selectedItem.key) - })); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/border-style.js - - -/** - * Internal dependencies - */ - - -/** - * Inspector control for configuring border style property. - * - * @param {Object} props Block properties. - * @return {WPElement} Border style edit element. - */ - -const BorderStyleEdit = props => { - var _style$border; - - const { - attributes: { - style - }, - setAttributes - } = props; - - const onChange = newBorderStyle => { - const newStyleAttributes = { ...style, - border: { ...(style === null || style === void 0 ? void 0 : style.border), - style: newBorderStyle - } - }; - setAttributes({ - style: cleanEmptyObject(newStyleAttributes) - }); - }; - - return Object(external_wp_element_["createElement"])(BorderStyleControl, { - value: style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.style, - onChange: onChange - }); -}; - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/border-width.js - - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -const MIN_BORDER_WIDTH = 0; -const MAX_BORDER_WIDTH = 50; -/** - * Inspector control for configuring border width property. - * - * @param {Object} props Block properties. - * @return {WPElement} Border width edit element. - */ - -const BorderWidthEdit = props => { - var _style$border; - - const { - attributes: { - style - }, - setAttributes - } = props; - - const onChange = newWidth => { - const newStyle = { ...style, - border: { ...(style === null || style === void 0 ? void 0 : style.border), - width: newWidth - } - }; - setAttributes({ - style: cleanEmptyObject(newStyle) - }); - }; - - return Object(external_wp_element_["createElement"])(external_wp_components_["RangeControl"], { - value: style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.width, - label: Object(external_wp_i18n_["__"])('Border width'), - min: MIN_BORDER_WIDTH, - max: MAX_BORDER_WIDTH, - initialPosition: 0, - allowReset: true, - onChange: onChange - }); -}; - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/border.js - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - - - - -const BORDER_SUPPORT_KEY = '__experimentalBorder'; -function BorderPanel(props) { - const isDisabled = useIsBorderDisabled(props); - const isSupported = hasBorderSupport(props.name); - const isColorSupported = useSetting('border.customColor') && hasBorderSupport(props.name, 'color'); - const isRadiusSupported = useSetting('border.customRadius') && hasBorderSupport(props.name, 'radius'); - const isStyleSupported = useSetting('border.customStyle') && hasBorderSupport(props.name, 'style'); - const isWidthSupported = useSetting('border.customWidth') && hasBorderSupport(props.name, 'width'); - - if (isDisabled || !isSupported) { - return null; - } - - return Object(external_wp_element_["createElement"])(inspector_controls, null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { - title: Object(external_wp_i18n_["__"])('Border settings'), - initialOpen: false - }, isStyleSupported && Object(external_wp_element_["createElement"])(BorderStyleEdit, props), isWidthSupported && Object(external_wp_element_["createElement"])(BorderWidthEdit, props), isRadiusSupported && Object(external_wp_element_["createElement"])(BorderRadiusEdit, props), isColorSupported && Object(external_wp_element_["createElement"])(BorderColorEdit, props))); -} -/** - * Determine whether there is block support for border properties. - * - * @param {string} blockName Block name. - * @param {string} feature Border feature to check support for. - * @return {boolean} Whether there is support. - */ - -function hasBorderSupport(blockName, feature = 'any') { - if (external_wp_element_["Platform"].OS !== 'web') { - return false; - } - - const support = Object(external_wp_blocks_["getBlockSupport"])(blockName, BORDER_SUPPORT_KEY); - - if (support === true) { - return true; - } - - if (feature === 'any') { - return !!(support !== null && support !== void 0 && support.color || support !== null && support !== void 0 && support.radius || support !== null && support !== void 0 && support.width || support !== null && support !== void 0 && support.style); - } - - return !!(support !== null && support !== void 0 && support[feature]); -} -/** - * Check whether serialization of border classes and styles should be skipped. - * - * @param {string|Object} blockType Block name or block type object. - * @return {boolean} Whether serialization of border properties should occur. - */ - -function shouldSkipSerialization(blockType) { - const support = Object(external_wp_blocks_["getBlockSupport"])(blockType, BORDER_SUPPORT_KEY); - return support === null || support === void 0 ? void 0 : support.__experimentalSkipSerialization; -} -/** - * Determines if all border support features have been disabled. - * - * @return {boolean} If border support is completely disabled. - */ - -const useIsBorderDisabled = () => { - const configs = [!useSetting('border.customColor'), !useSetting('border.customRadius'), !useSetting('border.customStyle'), !useSetting('border.customWidth')]; - return configs.every(Boolean); -}; - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/panel-color-gradient-settings.js - - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - - - // translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000) - -const panel_color_gradient_settings_colorIndicatorAriaLabel = Object(external_wp_i18n_["__"])('(%s: color %s)'); // translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000) - - -const panel_color_gradient_settings_gradientIndicatorAriaLabel = Object(external_wp_i18n_["__"])('(%s: gradient %s)'); - -const panel_color_gradient_settings_colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients']; - -const Indicators = ({ - colors, - gradients, - settings -}) => { - return settings.map(({ - colorValue, - gradientValue, - label, - colors: availableColors, - gradients: availableGradients - }, index) => { - if (!colorValue && !gradientValue) { - return null; - } - - let ariaLabel; - - if (colorValue) { - const colorObject = getColorObjectByColorValue(availableColors || colors, colorValue); - ariaLabel = Object(external_wp_i18n_["sprintf"])(panel_color_gradient_settings_colorIndicatorAriaLabel, label.toLowerCase(), colorObject && colorObject.name || colorValue); - } else { - const gradientObject = __experimentalGetGradientObjectByGradientValue(availableGradients || gradients, colorValue); - - ariaLabel = Object(external_wp_i18n_["sprintf"])(panel_color_gradient_settings_gradientIndicatorAriaLabel, label.toLowerCase(), gradientObject && gradientObject.name || gradientValue); - } - - return Object(external_wp_element_["createElement"])(external_wp_components_["ColorIndicator"], { - key: index, - colorValue: colorValue || gradientValue, - "aria-label": ariaLabel - }); - }); -}; - -const PanelColorGradientSettingsInner = ({ - className, - colors, - gradients, - disableCustomColors, - disableCustomGradients, - children, - settings, - title, - ...props -}) => { - if (Object(external_lodash_["isEmpty"])(colors) && Object(external_lodash_["isEmpty"])(gradients) && disableCustomColors && disableCustomGradients && Object(external_lodash_["every"])(settings, setting => Object(external_lodash_["isEmpty"])(setting.colors) && Object(external_lodash_["isEmpty"])(setting.gradients) && (setting.disableCustomColors === undefined || setting.disableCustomColors) && (setting.disableCustomGradients === undefined || setting.disableCustomGradients))) { - return null; - } - - const titleElement = Object(external_wp_element_["createElement"])("span", { - className: "block-editor-panel-color-gradient-settings__panel-title" - }, title, Object(external_wp_element_["createElement"])(Indicators, { - colors: colors, - gradients: gradients, - settings: settings - })); - return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], Object(esm_extends["a" /* default */])({ - className: classnames_default()('block-editor-panel-color-gradient-settings', className), - title: titleElement - }, props), settings.map((setting, index) => Object(external_wp_element_["createElement"])(control, Object(esm_extends["a" /* default */])({ - key: index, - colors, - gradients, - disableCustomColors, - disableCustomGradients - }, setting))), children); -}; - -const PanelColorGradientSettingsSelect = props => { - const colorGradientSettings = {}; - colorGradientSettings.colors = useSetting('color.palette'); - colorGradientSettings.gradients = useSetting('color.gradients'); - colorGradientSettings.disableCustomColors = !useSetting('color.custom'); - colorGradientSettings.disableCustomGradients = !useSetting('color.customGradient'); - return Object(external_wp_element_["createElement"])(PanelColorGradientSettingsInner, Object(esm_extends["a" /* default */])({}, colorGradientSettings, props)); -}; - -const PanelColorGradientSettings = props => { - if (Object(external_lodash_["every"])(panel_color_gradient_settings_colorsAndGradientKeys, key => props.hasOwnProperty(key))) { - return Object(external_wp_element_["createElement"])(PanelColorGradientSettingsInner, props); - } - - return Object(external_wp_element_["createElement"])(PanelColorGradientSettingsSelect, props); -}; - -/* harmony default export */ var panel_color_gradient_settings = (PanelColorGradientSettings); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/contrast-checker/index.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - -function ContrastCheckerMessage({ - tinyBackgroundColor, - tinyTextColor, - backgroundColor, - textColor -}) { - const msg = tinyBackgroundColor.getBrightness() < tinyTextColor.getBrightness() ? Object(external_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_wp_i18n_["__"])('This color combination may be hard for people to read. Try using a brighter background color and/or a darker text color.'); // Note: The `Notice` component can speak messages via its `spokenMessage` - // prop, but the contrast checker requires granular control over when the - // announcements are made. Notably, the message will be re-announced if a - // new color combination is selected and the contrast is still insufficient. - - Object(external_wp_element_["useEffect"])(() => { - Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('This color combination may be hard for people to read.')); - }, [backgroundColor, textColor]); - return Object(external_wp_element_["createElement"])("div", { - className: "block-editor-contrast-checker" - }, Object(external_wp_element_["createElement"])(external_wp_components_["Notice"], { - spokenMessage: null, - status: "warning", - isDismissible: false - }, msg)); -} - -function ContrastChecker({ - backgroundColor, - fallbackBackgroundColor, - fallbackTextColor, - fontSize, - // font size value in pixels - isLargeText, - textColor -}) { - if (!(backgroundColor || fallbackBackgroundColor) || !(textColor || fallbackTextColor)) { - return null; - } - - const tinyBackgroundColor = tinycolor_default()(backgroundColor || fallbackBackgroundColor); - const tinyTextColor = tinycolor_default()(textColor || fallbackTextColor); - const 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; - } - - return Object(external_wp_element_["createElement"])(ContrastCheckerMessage, { - backgroundColor: backgroundColor, - textColor: textColor, - tinyBackgroundColor: tinyBackgroundColor, - tinyTextColor: tinyTextColor - }); -} - -/* harmony default export */ var contrast_checker = (ContrastChecker); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/block-refs-provider.js - - -/** - * WordPress dependencies - */ - -const BlockRefs = Object(external_wp_element_["createContext"])(); -function BlockRefsProvider({ - children -}) { - const value = Object(external_wp_element_["useMemo"])(() => ({ - refs: new Map(), - callbacks: new Map() - }), []); - return Object(external_wp_element_["createElement"])(BlockRefs.Provider, { - value: value - }, children); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-refs.js -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -/** @typedef {import('@wordpress/element').RefCallback} RefCallback */ - -/** @typedef {import('@wordpress/element').RefObject} RefObject */ - -/** - * Provides a ref to the BlockRefs context. - * - * @param {string} clientId The client ID of the element ref. - * - * @return {RefCallback} Ref callback. - */ - -function useBlockRefProvider(clientId) { - const { - refs, - callbacks - } = Object(external_wp_element_["useContext"])(BlockRefs); - const ref = Object(external_wp_element_["useRef"])(); - Object(external_wp_element_["useLayoutEffect"])(() => { - refs.set(ref, clientId); - return () => { - refs.delete(ref); - }; - }, [clientId]); - return Object(external_wp_compose_["useRefEffect"])(element => { - // Update the ref in the provider. - ref.current = element; // Call any update functions. - - callbacks.forEach((id, setElement) => { - if (clientId === id) { - setElement(element); - } - }); - }, [clientId]); -} -/** - * Gets a ref pointing to the current block element. Continues to return a - * stable ref even if the block client ID changes. - * - * @param {string} clientId The client ID to get a ref for. - * - * @return {RefObject} A ref containing the element. - */ - -function useBlockRef(clientId) { - const { - refs - } = Object(external_wp_element_["useContext"])(BlockRefs); - const freshClientId = Object(external_wp_element_["useRef"])(); - freshClientId.current = clientId; // Always return an object, even if no ref exists for a given client ID, so - // that `current` works at a later point. - - return Object(external_wp_element_["useMemo"])(() => ({ - get current() { - let element = null; // Multiple refs may be created for a single block. Find the - // first that has an element set. - - for (const [ref, id] of refs.entries()) { - if (id === freshClientId.current && ref.current) { - element = ref.current; - } - } - - return element; - } - - }), []); -} -/** - * Return the element for a given client ID. Updates whenever the element - * changes, becomes available, or disappears. - * - * @param {string} clientId The client ID to an element for. - * - * @return {Element|null} The block's wrapper element. - */ - - -function useBlockElement(clientId) { - const { - callbacks - } = Object(external_wp_element_["useContext"])(BlockRefs); - const ref = useBlockRef(clientId); - const [element, setElement] = Object(external_wp_element_["useState"])(null); - Object(external_wp_element_["useLayoutEffect"])(() => { - if (!clientId) { - return; - } - - callbacks.set(setElement, clientId); - return () => { - callbacks.delete(setElement); - }; - }, [clientId]); - return ref.current || element; -} - - - - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/color-panel.js - - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - - - - - -function getComputedStyle(node) { - return node.ownerDocument.defaultView.getComputedStyle(node); -} - -function ColorPanel({ - settings, - clientId, - enableContrastChecking = true -}) { - const [detectedBackgroundColor, setDetectedBackgroundColor] = Object(external_wp_element_["useState"])(); - const [detectedColor, setDetectedColor] = Object(external_wp_element_["useState"])(); - const ref = useBlockRef(clientId); - Object(external_wp_element_["useEffect"])(() => { - if (!enableContrastChecking) { - return; - } - - if (!ref.current) { - return; - } - - setDetectedColor(getComputedStyle(ref.current).color); - let backgroundColorNode = ref.current; - let backgroundColor = getComputedStyle(backgroundColorNode).backgroundColor; - - while (backgroundColor === 'rgba(0, 0, 0, 0)' && backgroundColorNode.parentNode && backgroundColorNode.parentNode.nodeType === backgroundColorNode.parentNode.ELEMENT_NODE) { - backgroundColorNode = backgroundColorNode.parentNode; - backgroundColor = getComputedStyle(backgroundColorNode).backgroundColor; - } - - setDetectedBackgroundColor(backgroundColor); - }); - return Object(external_wp_element_["createElement"])(inspector_controls, null, Object(external_wp_element_["createElement"])(panel_color_gradient_settings, { - title: Object(external_wp_i18n_["__"])('Color'), - initialOpen: false, - settings: settings - }, enableContrastChecking && Object(external_wp_element_["createElement"])(contrast_checker, { - backgroundColor: detectedBackgroundColor, - textColor: detectedColor - }))); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/color.js - - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - - - - -const COLOR_SUPPORT_KEY = 'color'; -const color_EMPTY_ARRAY = []; - -const hasColorSupport = blockType => { - const colorSupport = Object(external_wp_blocks_["getBlockSupport"])(blockType, COLOR_SUPPORT_KEY); - return colorSupport && (colorSupport.link === true || colorSupport.gradient === true || colorSupport.background !== false || colorSupport.text !== false); -}; - -const color_shouldSkipSerialization = blockType => { - const colorSupport = Object(external_wp_blocks_["getBlockSupport"])(blockType, COLOR_SUPPORT_KEY); - return colorSupport === null || colorSupport === void 0 ? void 0 : colorSupport.__experimentalSkipSerialization; -}; - -const hasLinkColorSupport = blockType => { - if (external_wp_element_["Platform"].OS !== 'web') { - return false; - } - - const colorSupport = Object(external_wp_blocks_["getBlockSupport"])(blockType, COLOR_SUPPORT_KEY); - return Object(external_lodash_["isObject"])(colorSupport) && !!colorSupport.link; -}; - -const hasGradientSupport = blockType => { - if (external_wp_element_["Platform"].OS !== 'web') { - return false; - } - - const colorSupport = Object(external_wp_blocks_["getBlockSupport"])(blockType, COLOR_SUPPORT_KEY); - return Object(external_lodash_["isObject"])(colorSupport) && !!colorSupport.gradients; -}; - -const hasBackgroundColorSupport = blockType => { - const colorSupport = Object(external_wp_blocks_["getBlockSupport"])(blockType, COLOR_SUPPORT_KEY); - return colorSupport && colorSupport.background !== false; -}; - -const hasTextColorSupport = blockType => { - const colorSupport = Object(external_wp_blocks_["getBlockSupport"])(blockType, COLOR_SUPPORT_KEY); - return colorSupport && colorSupport.text !== false; -}; -/** - * Filters registered block settings, extending attributes to include - * `backgroundColor` and `textColor` attribute. - * - * @param {Object} settings Original block settings - * @return {Object} Filtered block settings - */ - - -function color_addAttributes(settings) { - if (!hasColorSupport(settings)) { - return settings; - } // allow blocks to specify their own attribute definition with default values if needed. - - - if (!settings.attributes.backgroundColor) { - Object.assign(settings.attributes, { - backgroundColor: { - type: 'string' - } - }); - } - - if (!settings.attributes.textColor) { - Object.assign(settings.attributes, { - textColor: { - type: 'string' - } - }); - } - - if (hasGradientSupport(settings) && !settings.attributes.gradient) { - Object.assign(settings.attributes, { - gradient: { - type: 'string' - } - }); - } - - return settings; -} -/** - * Override props assigned to save component to inject colors classnames. - * - * @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 color_addSaveProps(props, blockType, attributes) { - var _style$color, _style$color2, _style$color3, _style$color4, _style$elements, _style$elements$link; - - if (!hasColorSupport(blockType) || color_shouldSkipSerialization(blockType)) { - return props; - } - - const hasGradient = hasGradientSupport(blockType); // I'd have prefered to avoid the "style" attribute usage here - - const { - backgroundColor, - textColor, - gradient, - style - } = attributes; - const backgroundClass = getColorClassName('background-color', backgroundColor); - - const gradientClass = __experimentalGetGradientClass(gradient); - - const textClass = getColorClassName('color', textColor); - const newClassName = classnames_default()(props.className, textClass, gradientClass, { - // Don't apply the background class if there's a custom gradient - [backgroundClass]: (!hasGradient || !(style !== null && style !== void 0 && (_style$color = style.color) !== null && _style$color !== void 0 && _style$color.gradient)) && !!backgroundClass, - 'has-text-color': textColor || (style === null || style === void 0 ? void 0 : (_style$color2 = style.color) === null || _style$color2 === void 0 ? void 0 : _style$color2.text), - 'has-background': backgroundColor || (style === null || style === void 0 ? void 0 : (_style$color3 = style.color) === null || _style$color3 === void 0 ? void 0 : _style$color3.background) || hasGradient && (gradient || (style === null || style === void 0 ? void 0 : (_style$color4 = style.color) === null || _style$color4 === void 0 ? void 0 : _style$color4.gradient)), - 'has-link-color': style === null || style === void 0 ? void 0 : (_style$elements = style.elements) === null || _style$elements === void 0 ? void 0 : (_style$elements$link = _style$elements.link) === null || _style$elements$link === void 0 ? void 0 : _style$elements$link.color - }); - props.className = newClassName ? newClassName : undefined; - return props; -} -/** - * Filters registered block settings to extand the block edit wrapper - * to apply the desired styles and classnames properly. - * - * @param {Object} settings Original block settings - * @return {Object} Filtered block settings - */ - -function color_addEditProps(settings) { - if (!hasColorSupport(settings) || color_shouldSkipSerialization(settings)) { - return settings; - } - - const existingGetEditWrapperProps = settings.getEditWrapperProps; - - settings.getEditWrapperProps = attributes => { - let props = {}; - - if (existingGetEditWrapperProps) { - props = existingGetEditWrapperProps(attributes); - } - - return color_addSaveProps(props, settings, attributes); - }; - - return settings; -} - -const getLinkColorFromAttributeValue = (colors, value) => { - const attributeParsed = /var:preset\|color\|(.+)/.exec(value); - - if (attributeParsed && attributeParsed[1]) { - return getColorObjectByAttributeValues(colors, attributeParsed[1]).color; - } - - return value; -}; - -function immutableSet(object, path, value) { - return Object(external_lodash_["setWith"])(object ? Object(external_lodash_["clone"])(object) : {}, path, value, external_lodash_["clone"]); -} -/** - * Inspector control panel containing the color related configuration - * - * @param {Object} props - * - * @return {WPElement} Color edit element. - */ - - -function ColorEdit(props) { - var _style$color6, _style$color7, _style$color8, _style$elements2, _style$elements2$link, _style$elements2$link2, _style$elements3, _style$elements3$link, _style$elements3$link2; - - const { - name: blockName, - attributes - } = props; - const solids = useSetting('color.palette') || color_EMPTY_ARRAY; - const gradients = useSetting('color.gradients') || color_EMPTY_ARRAY; - const areCustomSolidsEnabled = useSetting('color.custom'); - const areCustomGradientsEnabled = useSetting('color.customGradient'); - const isLinkEnabled = useSetting('color.link'); // Shouldn't be needed but right now the ColorGradientsPanel - // can trigger both onChangeColor and onChangeBackground - // synchronously causing our two callbacks to override changes - // from each other. - - const localAttributes = Object(external_wp_element_["useRef"])(attributes); - Object(external_wp_element_["useEffect"])(() => { - localAttributes.current = attributes; - }, [attributes]); - - if (!hasColorSupport(blockName) || external_wp_element_["Platform"].OS !== 'web') { - return null; - } - - const hasLinkColor = hasLinkColorSupport(blockName) && isLinkEnabled && (solids.length > 0 || areCustomSolidsEnabled); - const hasTextColor = hasTextColorSupport(blockName) && (solids.length > 0 || areCustomSolidsEnabled); - const hasBackgroundColor = hasBackgroundColorSupport(blockName) && (solids.length > 0 || areCustomSolidsEnabled); - const hasGradientColor = hasGradientSupport(blockName) && (gradients.length > 0 || areCustomGradientsEnabled); - - if (!hasLinkColor && !hasTextColor && !hasBackgroundColor && !hasGradientColor) { - return null; - } - - const { - style, - textColor, - backgroundColor, - gradient - } = attributes; - let gradientValue; - - if (hasGradientColor && gradient) { - gradientValue = getGradientValueBySlug(gradients, gradient); - } else if (hasGradientColor) { - var _style$color5; - - gradientValue = style === null || style === void 0 ? void 0 : (_style$color5 = style.color) === null || _style$color5 === void 0 ? void 0 : _style$color5.gradient; - } - - const onChangeColor = name => value => { - var _localAttributes$curr, _localAttributes$curr2; - - const colorObject = getColorObjectByColorValue(solids, value); - const attributeName = name + 'Color'; - const newStyle = { ...localAttributes.current.style, - color: { ...((_localAttributes$curr = localAttributes.current) === null || _localAttributes$curr === void 0 ? void 0 : (_localAttributes$curr2 = _localAttributes$curr.style) === null || _localAttributes$curr2 === void 0 ? void 0 : _localAttributes$curr2.color), - [name]: colorObject !== null && colorObject !== void 0 && colorObject.slug ? undefined : value - } - }; - const newNamedColor = colorObject !== null && colorObject !== void 0 && colorObject.slug ? colorObject.slug : undefined; - const newAttributes = { - style: cleanEmptyObject(newStyle), - [attributeName]: newNamedColor - }; - props.setAttributes(newAttributes); - localAttributes.current = { ...localAttributes.current, - ...newAttributes - }; - }; - - const onChangeGradient = value => { - const slug = getGradientSlugByValue(gradients, value); - let newAttributes; - - if (slug) { - var _localAttributes$curr3, _localAttributes$curr4, _localAttributes$curr5; - - const newStyle = { ...((_localAttributes$curr3 = localAttributes.current) === null || _localAttributes$curr3 === void 0 ? void 0 : _localAttributes$curr3.style), - color: { ...((_localAttributes$curr4 = localAttributes.current) === null || _localAttributes$curr4 === void 0 ? void 0 : (_localAttributes$curr5 = _localAttributes$curr4.style) === null || _localAttributes$curr5 === void 0 ? void 0 : _localAttributes$curr5.color), - gradient: undefined - } - }; - newAttributes = { - style: cleanEmptyObject(newStyle), - gradient: slug - }; - } else { - var _localAttributes$curr6, _localAttributes$curr7, _localAttributes$curr8; - - const newStyle = { ...((_localAttributes$curr6 = localAttributes.current) === null || _localAttributes$curr6 === void 0 ? void 0 : _localAttributes$curr6.style), - color: { ...((_localAttributes$curr7 = localAttributes.current) === null || _localAttributes$curr7 === void 0 ? void 0 : (_localAttributes$curr8 = _localAttributes$curr7.style) === null || _localAttributes$curr8 === void 0 ? void 0 : _localAttributes$curr8.color), - gradient: value - } - }; - newAttributes = { - style: cleanEmptyObject(newStyle), - gradient: undefined - }; - } - - props.setAttributes(newAttributes); - localAttributes.current = { ...localAttributes.current, - ...newAttributes - }; - }; - - const onChangeLinkColor = value => { - const colorObject = getColorObjectByColorValue(solids, value); - const newLinkColorValue = colorObject !== null && colorObject !== void 0 && colorObject.slug ? `var:preset|color|${colorObject.slug}` : value; - const newStyle = immutableSet(style, ['elements', 'link', 'color', 'text'], newLinkColorValue); - props.setAttributes({ - style: newStyle - }); - }; - - return Object(external_wp_element_["createElement"])(ColorPanel, { - enableContrastChecking: // Turn on contrast checker for web only since it's not supported on mobile yet. - external_wp_element_["Platform"].OS === 'web' && !gradient && !(style !== null && style !== void 0 && (_style$color6 = style.color) !== null && _style$color6 !== void 0 && _style$color6.gradient), - clientId: props.clientId, - settings: [...(hasTextColor ? [{ - label: Object(external_wp_i18n_["__"])('Text color'), - onColorChange: onChangeColor('text'), - colorValue: getColorObjectByAttributeValues(solids, textColor, style === null || style === void 0 ? void 0 : (_style$color7 = style.color) === null || _style$color7 === void 0 ? void 0 : _style$color7.text).color - }] : []), ...(hasBackgroundColor || hasGradientColor ? [{ - label: Object(external_wp_i18n_["__"])('Background color'), - onColorChange: hasBackgroundColor ? onChangeColor('background') : undefined, - colorValue: getColorObjectByAttributeValues(solids, backgroundColor, style === null || style === void 0 ? void 0 : (_style$color8 = style.color) === null || _style$color8 === void 0 ? void 0 : _style$color8.background).color, - gradientValue, - onGradientChange: hasGradientColor ? onChangeGradient : undefined - }] : []), ...(hasLinkColor ? [{ - label: Object(external_wp_i18n_["__"])('Link Color'), - onColorChange: onChangeLinkColor, - colorValue: getLinkColorFromAttributeValue(solids, style === null || style === void 0 ? void 0 : (_style$elements2 = style.elements) === null || _style$elements2 === void 0 ? void 0 : (_style$elements2$link = _style$elements2.link) === null || _style$elements2$link === void 0 ? void 0 : (_style$elements2$link2 = _style$elements2$link.color) === null || _style$elements2$link2 === void 0 ? void 0 : _style$elements2$link2.text), - clearable: !!(style !== null && style !== void 0 && (_style$elements3 = style.elements) !== null && _style$elements3 !== void 0 && (_style$elements3$link = _style$elements3.link) !== null && _style$elements3$link !== void 0 && (_style$elements3$link2 = _style$elements3$link.color) !== null && _style$elements3$link2 !== void 0 && _style$elements3$link2.text) - }] : [])] - }); -} -/** - * This adds inline styles for color palette colors. - * Ideally, this is not needed and themes should load their palettes on the editor. - * - * @param {Function} BlockListBlock Original component - * @return {Function} Wrapped component - */ - -const withColorPaletteStyles = Object(external_wp_compose_["createHigherOrderComponent"])(BlockListBlock => props => { - var _getColorObjectByAttr, _getColorObjectByAttr2, _props$wrapperProps; - - const { - name, - attributes - } = props; - const { - backgroundColor, - textColor - } = attributes; - const colors = useSetting('color.palette') || color_EMPTY_ARRAY; - - if (!hasColorSupport(name) || color_shouldSkipSerialization(name)) { - return Object(external_wp_element_["createElement"])(BlockListBlock, props); - } - - const extraStyles = { - color: textColor ? (_getColorObjectByAttr = getColorObjectByAttributeValues(colors, textColor)) === null || _getColorObjectByAttr === void 0 ? void 0 : _getColorObjectByAttr.color : undefined, - backgroundColor: backgroundColor ? (_getColorObjectByAttr2 = getColorObjectByAttributeValues(colors, backgroundColor)) === null || _getColorObjectByAttr2 === void 0 ? void 0 : _getColorObjectByAttr2.color : undefined - }; - let wrapperProps = props.wrapperProps; - wrapperProps = { ...props.wrapperProps, - style: { ...extraStyles, - ...((_props$wrapperProps = props.wrapperProps) === null || _props$wrapperProps === void 0 ? void 0 : _props$wrapperProps.style) - } - }; - return Object(external_wp_element_["createElement"])(BlockListBlock, Object(esm_extends["a" /* default */])({}, props, { - wrapperProps: wrapperProps - })); -}); -Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/color/addAttribute', color_addAttributes); -Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/color/addSaveProps', color_addSaveProps); -Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/color/addEditProps', color_addEditProps); -Object(external_wp_hooks_["addFilter"])('editor.BlockListBlock', 'core/color/with-color-palette-styles', withColorPaletteStyles); - -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-underline.js - - -/** - * WordPress dependencies - */ - -const formatUnderline = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { - d: "M7 18v1h10v-1H7zm5-2c1.5 0 2.6-.4 3.4-1.2.8-.8 1.1-2 1.1-3.5V5H15v5.8c0 1.2-.2 2.1-.6 2.8-.4.7-1.2 1-2.4 1s-2-.3-2.4-1c-.4-.7-.6-1.6-.6-2.8V5H7.5v6.2c0 1.5.4 2.7 1.1 3.5.8.9 1.9 1.3 3.4 1.3z" -})); -/* harmony default export */ var format_underline = (formatUnderline); - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/format-strikethrough.js -var format_strikethrough = __webpack_require__("Crq9"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/text-decoration-control/index.js - - -/** - * WordPress dependencies - */ - - - -const TEXT_DECORATIONS = [{ - name: Object(external_wp_i18n_["__"])('Underline'), - value: 'underline', - icon: format_underline -}, { - name: Object(external_wp_i18n_["__"])('Strikethrough'), - value: 'line-through', - icon: format_strikethrough["a" /* default */] -}]; -/** - * Control to facilitate text decoration selections. - * - * @param {Object} props Component props. - * @param {string} props.value Currently selected text decoration. - * @param {Function} props.onChange Handles change in text decoration selection. - * @return {WPElement} Text decoration control. - */ - -function TextDecorationControl({ - value, - onChange -}) { - return Object(external_wp_element_["createElement"])("fieldset", { - className: "block-editor-text-decoration-control" - }, Object(external_wp_element_["createElement"])("legend", null, Object(external_wp_i18n_["__"])('Decoration')), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-text-decoration-control__buttons" - }, TEXT_DECORATIONS.map(textDecoration => { - return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - key: textDecoration.value, - icon: textDecoration.icon, - isSmall: true, - isPressed: textDecoration.value === value, - onClick: () => onChange(textDecoration.value === value ? undefined : textDecoration.value), - "aria-label": textDecoration.name - }); - }))); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/text-decoration.js - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - - - -/** - * Key within block settings' supports array indicating support for text - * decorations e.g. settings found in `block.json`. - */ - -const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration'; -/** - * Inspector control panel containing the text decoration options. - * - * @param {Object} props Block properties. - * @return {WPElement} Text decoration edit element. - */ - -function TextDecorationEdit(props) { - var _style$typography; - - const { - attributes: { - style - }, - setAttributes - } = props; - const isDisabled = useIsTextDecorationDisabled(props); - - if (isDisabled) { - return null; - } - - function onChange(newDecoration) { - setAttributes({ - style: cleanEmptyObject({ ...style, - typography: { ...(style === null || style === void 0 ? void 0 : style.typography), - textDecoration: newDecoration - } - }) - }); - } - - return Object(external_wp_element_["createElement"])(TextDecorationControl, { - value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.textDecoration, - onChange: onChange - }); -} -/** - * Checks if text-decoration settings have been disabled. - * - * @param {string} name Name of the block. - * @return {boolean} Whether or not the setting is disabled. - */ - -function useIsTextDecorationDisabled({ - name: blockName -} = {}) { - const notSupported = !Object(external_wp_blocks_["hasBlockSupport"])(blockName, TEXT_DECORATION_SUPPORT_KEY); - const hasTextDecoration = useSetting('typography.customTextDecorations'); - return notSupported || !hasTextDecoration; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-uppercase.js - - -/** - * WordPress dependencies - */ - -const formatUppercase = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { - d: "M6.1 6.8L2.1 18h1.6l1.1-3h4.3l1.1 3h1.6l-4-11.2H6.1zm-.8 6.8L7 8.9l1.7 4.7H5.3zm15.1-.7c-.4-.5-.9-.8-1.6-1 .4-.2.7-.5.8-.9.2-.4.3-.9.3-1.4 0-.9-.3-1.6-.8-2-.6-.5-1.3-.7-2.4-.7h-3.5V18h4.2c1.1 0 2-.3 2.6-.8.6-.6 1-1.4 1-2.4-.1-.8-.3-1.4-.6-1.9zm-5.7-4.7h1.8c.6 0 1.1.1 1.4.4.3.2.5.7.5 1.3 0 .6-.2 1.1-.5 1.3-.3.2-.8.4-1.4.4h-1.8V8.2zm4 8c-.4.3-.9.5-1.5.5h-2.6v-3.8h2.6c1.4 0 2 .6 2 1.9.1.6-.1 1-.5 1.4z" -})); -/* harmony default export */ var format_uppercase = (formatUppercase); - -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-lowercase.js - - -/** - * WordPress dependencies - */ - -const formatLowercase = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { - d: "M11 16.8c-.1-.1-.2-.3-.3-.5v-2.6c0-.9-.1-1.7-.3-2.2-.2-.5-.5-.9-.9-1.2-.4-.2-.9-.3-1.6-.3-.5 0-1 .1-1.5.2s-.9.3-1.2.6l.2 1.2c.4-.3.7-.4 1.1-.5.3-.1.7-.2 1-.2.6 0 1 .1 1.3.4.3.2.4.7.4 1.4-1.2 0-2.3.2-3.3.7s-1.4 1.1-1.4 2.1c0 .7.2 1.2.7 1.6.4.4 1 .6 1.8.6.9 0 1.7-.4 2.4-1.2.1.3.2.5.4.7.1.2.3.3.6.4.3.1.6.1 1.1.1h.1l.2-1.2h-.1c-.4.1-.6 0-.7-.1zM9.2 16c-.2.3-.5.6-.9.8-.3.1-.7.2-1.1.2-.4 0-.7-.1-.9-.3-.2-.2-.3-.5-.3-.9 0-.6.2-1 .7-1.3.5-.3 1.3-.4 2.5-.5v2zm10.6-3.9c-.3-.6-.7-1.1-1.2-1.5-.6-.4-1.2-.6-1.9-.6-.5 0-.9.1-1.4.3-.4.2-.8.5-1.1.8V6h-1.4v12h1.3l.2-1c.2.4.6.6 1 .8.4.2.9.3 1.4.3.7 0 1.2-.2 1.8-.5.5-.4 1-.9 1.3-1.5.3-.6.5-1.3.5-2.1-.1-.6-.2-1.3-.5-1.9zm-1.7 4c-.4.5-.9.8-1.6.8s-1.2-.2-1.7-.7c-.4-.5-.7-1.2-.7-2.1 0-.9.2-1.6.7-2.1.4-.5 1-.7 1.7-.7s1.2.3 1.6.8c.4.5.6 1.2.6 2s-.2 1.4-.6 2z" -})); -/* harmony default export */ var format_lowercase = (formatLowercase); - -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-capitalize.js - - -/** - * WordPress dependencies - */ - -const formatCapitalize = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { - d: "M7.1 6.8L3.1 18h1.6l1.1-3h4.3l1.1 3h1.6l-4-11.2H7.1zm-.8 6.8L8 8.9l1.7 4.7H6.3zm14.5-1.5c-.3-.6-.7-1.1-1.2-1.5-.6-.4-1.2-.6-1.9-.6-.5 0-.9.1-1.4.3-.4.2-.8.5-1.1.8V6h-1.4v12h1.3l.2-1c.2.4.6.6 1 .8.4.2.9.3 1.4.3.7 0 1.2-.2 1.8-.5.5-.4 1-.9 1.3-1.5.3-.6.5-1.3.5-2.1-.1-.6-.2-1.3-.5-1.9zm-1.7 4c-.4.5-.9.8-1.6.8s-1.2-.2-1.7-.7c-.4-.5-.7-1.2-.7-2.1 0-.9.2-1.6.7-2.1.4-.5 1-.7 1.7-.7s1.2.3 1.6.8c.4.5.6 1.2.6 2 .1.8-.2 1.4-.6 2z" -})); -/* harmony default export */ var format_capitalize = (formatCapitalize); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/text-transform-control/index.js - - -/** - * WordPress dependencies - */ - - - -const TEXT_TRANSFORMS = [{ - name: Object(external_wp_i18n_["__"])('Uppercase'), - value: 'uppercase', - icon: format_uppercase -}, { - name: Object(external_wp_i18n_["__"])('Lowercase'), - value: 'lowercase', - icon: format_lowercase -}, { - name: Object(external_wp_i18n_["__"])('Capitalize'), - value: 'capitalize', - icon: format_capitalize -}]; -/** - * Control to facilitate text transform selections. - * - * @param {Object} props Component props. - * @param {string} props.value Currently selected text transform. - * @param {Function} props.onChange Handles change in text transform selection. - * @return {WPElement} Text transform control. - */ - -function TextTransformControl({ - value, - onChange -}) { - return Object(external_wp_element_["createElement"])("fieldset", { - className: "block-editor-text-transform-control" - }, Object(external_wp_element_["createElement"])("legend", null, Object(external_wp_i18n_["__"])('Letter case')), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-text-transform-control__buttons" - }, TEXT_TRANSFORMS.map(textTransform => { - return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - key: textTransform.value, - icon: textTransform.icon, - isSmall: true, - isPressed: value === textTransform.value, - "aria-label": textTransform.name, - onClick: () => onChange(value === textTransform.value ? undefined : textTransform.value) - }); - }))); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/text-transform.js - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - - - -/** - * Key within block settings' supports array indicating support for text - * transforms e.g. settings found in `block.json`. - */ - -const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform'; -/** - * Inspector control panel containing the text transform options. - * - * @param {Object} props Block properties. - * @return {WPElement} Text transform edit element. - */ - -function TextTransformEdit(props) { - var _style$typography; - - const { - attributes: { - style - }, - setAttributes - } = props; - const isDisabled = useIsTextTransformDisabled(props); - - if (isDisabled) { - return null; - } - - function onChange(newTransform) { - setAttributes({ - style: cleanEmptyObject({ ...style, - typography: { ...(style === null || style === void 0 ? void 0 : style.typography), - textTransform: newTransform - } - }) - }); - } - - return Object(external_wp_element_["createElement"])(TextTransformControl, { - value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.textTransform, - onChange: onChange - }); -} -/** - * Checks if text-transform settings have been disabled. - * - * @param {string} name Name of the block. - * @return {boolean} Whether or not the setting is disabled. - */ - -function useIsTextTransformDisabled({ - name: blockName -} = {}) { - const notSupported = !Object(external_wp_blocks_["hasBlockSupport"])(blockName, TEXT_TRANSFORM_SUPPORT_KEY); - const hasTextTransforms = useSetting('typography.customTextTransforms'); - return notSupported || !hasTextTransforms; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/text-decoration-and-transform/index.js - - -/** - * Internal dependencies - */ - - -/** - * Handles grouping related text decoration and text transform edit components - * so they can be laid out in a more flexible manner within the Typography - * InspectorControls panel. - * - * @param {Object} props Block props to be passed on to individual controls. - * @return {WPElement} Component containing text decoration or transform controls. - */ - -function TextDecorationAndTransformEdit(props) { - const decorationAvailable = !useIsTextDecorationDisabled(props); - const transformAvailable = !useIsTextTransformDisabled(props); - - if (!decorationAvailable && !transformAvailable) { - return null; - } - - return Object(external_wp_element_["createElement"])("div", { - className: "block-editor-text-decoration-and-transform" - }, decorationAvailable && Object(external_wp_element_["createElement"])(TextDecorationEdit, props), transformAvailable && Object(external_wp_element_["createElement"])(TextTransformEdit, props)); -} - -// EXTERNAL MODULE: external ["wp","keycodes"] -var external_wp_keycodes_ = __webpack_require__("RxS6"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/line-height-control/utils.js -const BASE_DEFAULT_VALUE = 1.5; -const STEP = 0.1; -/** - * There are varying value types within LineHeightControl: - * - * {undefined} Initial value. No changes from the user. - * {string} Input value. Value consumed/outputted by the input. Empty would be ''. - * {number} Block attribute type. Input value needs to be converted for attribute setting. - * - * Note: If the value is undefined, the input requires it to be an empty string ('') - * in order to be considered "controlled" by props (rather than internal state). - */ - -const RESET_VALUE = ''; -/** - * Determines if the lineHeight attribute has been properly defined. - * - * @param {any} lineHeight The value to check. - * - * @return {boolean} Whether the lineHeight attribute is valid. - */ - -function isLineHeightDefined(lineHeight) { - return lineHeight !== undefined && lineHeight !== RESET_VALUE; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/line-height-control/index.js - - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - -function LineHeightControl({ - value: lineHeight, - onChange -}) { - const isDefined = isLineHeightDefined(lineHeight); - - const handleOnKeyDown = event => { - const { - keyCode - } = event; - - if (keyCode === external_wp_keycodes_["ZERO"] && !isDefined) { - /** - * Prevents the onChange callback from firing, which prevents - * the logic from assuming the change was triggered from - * an input arrow CLICK. - */ - event.preventDefault(); - onChange('0'); - } - }; - - const handleOnChange = nextValue => { - // Set the next value without modification if lineHeight has been defined - if (isDefined) { - onChange(nextValue); - return; - } // Otherwise... - - /** - * The following logic handles the initial up/down arrow CLICK of the - * input element. This is so that the next values (from an undefined value state) - * are more better suited for line-height rendering. - */ - - - let adjustedNextValue = nextValue; - - switch (nextValue) { - case `${STEP}`: - // Increment by step value - adjustedNextValue = BASE_DEFAULT_VALUE + STEP; - break; - - case '0': - // Decrement by step value - adjustedNextValue = BASE_DEFAULT_VALUE - STEP; - break; - } - - onChange(adjustedNextValue); - }; - - const value = isDefined ? lineHeight : RESET_VALUE; - return Object(external_wp_element_["createElement"])("div", { - className: "block-editor-line-height-control" - }, Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { - autoComplete: "off", - onKeyDown: handleOnKeyDown, - onChange: handleOnChange, - label: Object(external_wp_i18n_["__"])('Line height'), - placeholder: BASE_DEFAULT_VALUE, - step: STEP, - type: "number", - value: value, - min: 0 - })); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/line-height.js - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - - - -const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight'; -/** - * Inspector control panel containing the line height related configuration - * - * @param {Object} props - * - * @return {WPElement} Line height edit element. - */ - -function LineHeightEdit(props) { - var _style$typography; - - const { - attributes: { - style - } - } = props; - const isDisabled = useIsLineHeightDisabled(props); - - if (isDisabled) { - return null; - } - - const onChange = newLineHeightValue => { - const newStyle = { ...style, - typography: { ...(style === null || style === void 0 ? void 0 : style.typography), - lineHeight: newLineHeightValue - } - }; - props.setAttributes({ - style: cleanEmptyObject(newStyle) - }); - }; - - return Object(external_wp_element_["createElement"])(LineHeightControl, { - value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.lineHeight, - onChange: onChange - }); -} -/** - * Custom hook that checks if line-height settings have been disabled. - * - * @param {string} name The name of the block. - * @return {boolean} Whether setting is disabled. - */ - -function useIsLineHeightDisabled({ - name: blockName -} = {}) { - const isDisabled = !useSetting('typography.customLineHeight'); - return !Object(external_wp_blocks_["hasBlockSupport"])(blockName, LINE_HEIGHT_SUPPORT_KEY) || isDisabled; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-appearance-control/index.js - - -/** - * WordPress dependencies - */ - - - -const FONT_STYLES = [{ - name: Object(external_wp_i18n_["__"])('Regular'), - value: 'normal' -}, { - name: Object(external_wp_i18n_["__"])('Italic'), - value: 'italic' -}]; -const FONT_WEIGHTS = [{ - name: Object(external_wp_i18n_["__"])('Thin'), - value: '100' -}, { - name: Object(external_wp_i18n_["__"])('Extra Light'), - value: '200' -}, { - name: Object(external_wp_i18n_["__"])('Light'), - value: '300' -}, { - name: Object(external_wp_i18n_["__"])('Regular'), - value: '400' -}, { - name: Object(external_wp_i18n_["__"])('Medium'), - value: '500' -}, { - name: Object(external_wp_i18n_["__"])('Semi Bold'), - value: '600' -}, { - name: Object(external_wp_i18n_["__"])('Bold'), - value: '700' -}, { - name: Object(external_wp_i18n_["__"])('Extra Bold'), - value: '800' -}, { - name: Object(external_wp_i18n_["__"])('Black'), - value: '900' -}]; -/** - * Control to display unified font style and weight options. - * - * @param {Object} props Component props. - * @return {WPElement} Font appearance control. - */ - -function FontAppearanceControl(props) { - const { - onChange, - hasFontStyles = true, - hasFontWeights = true, - value: { - fontStyle, - fontWeight - } - } = props; - const hasStylesOrWeights = hasFontStyles || hasFontWeights; - const defaultOption = { - key: 'default', - name: Object(external_wp_i18n_["__"])('Default'), - style: { - fontStyle: undefined, - fontWeight: undefined - } - }; // Combines both font style and weight options into a single dropdown. - - const combineOptions = () => { - const combinedOptions = [defaultOption]; - FONT_STYLES.forEach(({ - name: styleName, - value: styleValue - }) => { - FONT_WEIGHTS.forEach(({ - name: weightName, - value: weightValue - }) => { - const optionName = styleValue === 'normal' ? weightName : Object(external_wp_i18n_["sprintf"])( - /* translators: 1: Font weight name. 2: Font style name. */ - Object(external_wp_i18n_["__"])('%1$s %2$s'), weightName, styleName); - combinedOptions.push({ - key: `${styleValue}-${weightValue}`, - name: optionName, - style: { - fontStyle: styleValue, - fontWeight: weightValue - } + const sideRules = ['top', 'right', 'bottom', 'left'].reduce((acc, side) => { + const value = (0,external_lodash_namespaceObject.get)(boxStyle, [side]); + + if (value) { + acc.push({ + selector: options.selector, + key: `${ruleKey}${(0,external_lodash_namespaceObject.upperFirst)(side)}`, + value }); - }); - }); - return combinedOptions; - }; // Generates select options for font styles only. - - - const styleOptions = () => { - const combinedOptions = [defaultOption]; - FONT_STYLES.forEach(({ - name, - value - }) => { - combinedOptions.push({ - key: value, - name, - style: { - fontStyle: value, - fontWeight: undefined - } - }); - }); - return combinedOptions; - }; // Generates select options for font weights only. - - - const weightOptions = () => { - const combinedOptions = [defaultOption]; - FONT_WEIGHTS.forEach(({ - name, - value - }) => { - combinedOptions.push({ - key: value, - name, - style: { - fontStyle: undefined, - fontWeight: value - } - }); - }); - return combinedOptions; - }; // Map font styles and weights to select options. - - - const selectOptions = Object(external_wp_element_["useMemo"])(() => { - if (hasFontStyles && hasFontWeights) { - return combineOptions(); - } - - return hasFontStyles ? styleOptions() : weightOptions(); - }, [props.options]); // Find current selection by comparing font style & weight against options. - - const currentSelection = selectOptions.find(option => option.style.fontStyle === fontStyle && option.style.fontWeight === fontWeight); // Adjusts field label in case either styles or weights are disabled. - - const getLabel = () => { - if (!hasFontStyles) { - return Object(external_wp_i18n_["__"])('Font weight'); - } - - if (!hasFontWeights) { - return Object(external_wp_i18n_["__"])('Font style'); - } - - return Object(external_wp_i18n_["__"])('Appearance'); - }; - - return Object(external_wp_element_["createElement"])("fieldset", { - className: "components-font-appearance-control" - }, hasStylesOrWeights && Object(external_wp_element_["createElement"])(external_wp_components_["CustomSelectControl"], { - className: "components-font-appearance-control__select", - label: getLabel(), - options: selectOptions, - value: currentSelection, - onChange: ({ - selectedItem - }) => onChange(selectedItem.style) - })); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/font-appearance.js - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - - - -/** - * Key within block settings' support array indicating support for font style. - */ - -const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle'; -/** - * Key within block settings' support array indicating support for font weight. - */ - -const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight'; -/** - * Inspector control panel containing the font appearance options. - * - * @param {Object} props Block properties. - * @return {WPElement} Font appearance edit element. - */ - -function FontAppearanceEdit(props) { - var _style$typography, _style$typography2; - - const { - attributes: { - style - }, - setAttributes - } = props; - const hasFontStyles = !useIsFontStyleDisabled(props); - const hasFontWeights = !useIsFontWeightDisabled(props); - - if (!hasFontStyles && !hasFontWeights) { - return null; - } - - const onChange = newStyles => { - setAttributes({ - style: cleanEmptyObject({ ...style, - typography: { ...(style === null || style === void 0 ? void 0 : style.typography), - fontStyle: newStyles.fontStyle, - fontWeight: newStyles.fontWeight - } - }) - }); - }; - - const fontStyle = style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.fontStyle; - const fontWeight = style === null || style === void 0 ? void 0 : (_style$typography2 = style.typography) === null || _style$typography2 === void 0 ? void 0 : _style$typography2.fontWeight; - return Object(external_wp_element_["createElement"])(FontAppearanceControl, { - onChange: onChange, - hasFontStyles: hasFontStyles, - hasFontWeights: hasFontWeights, - value: { - fontStyle, - fontWeight - } - }); -} -/** - * Checks if font style support has been disabled either by not opting in for - * support or by failing to provide preset styles. - * - * @param {Object} props Block properties. - * @param {string} props.name Name for the block type. - * @return {boolean} Whether font style support has been disabled. - */ - -function useIsFontStyleDisabled({ - name: blockName -} = {}) { - const styleSupport = Object(external_wp_blocks_["hasBlockSupport"])(blockName, FONT_STYLE_SUPPORT_KEY); - const hasFontStyles = useSetting('typography.customFontStyle'); - return !styleSupport || !hasFontStyles; -} -/** - * Checks if font weight support has been disabled either by not opting in for - * support or by failing to provide preset weights. - * - * @param {Object} props Block properties. - * @param {string} props.name Name for the block type. - * @return {boolean} Whether font weight support has been disabled. - */ - -function useIsFontWeightDisabled({ - name: blockName -} = {}) { - const weightSupport = Object(external_wp_blocks_["hasBlockSupport"])(blockName, FONT_WEIGHT_SUPPORT_KEY); - const hasFontWeights = useSetting('typography.customFontWeight'); - return !weightSupport || !hasFontWeights; -} -/** - * Checks if font appearance support has been disabled. - * - * @param {Object} props Block properties. - * @return {boolean} Whether font appearance support has been disabled. - */ - -function useIsFontAppearanceDisabled(props) { - const stylesDisabled = useIsFontStyleDisabled(props); - const weightsDisabled = useIsFontWeightDisabled(props); - return stylesDisabled && weightsDisabled; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-family/index.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - -function FontFamilyControl({ - value = '', - onChange, - fontFamilies, - ...props -}) { - const blockLevelFontFamilies = useSetting('typography.fontFamilies'); - - if (!fontFamilies) { - fontFamilies = blockLevelFontFamilies; - } - - if (Object(external_lodash_["isEmpty"])(fontFamilies)) { - return null; - } - - const options = [{ - value: '', - label: Object(external_wp_i18n_["__"])('Default') - }, ...fontFamilies.map(({ - fontFamily, - name - }) => { - return { - value: fontFamily, - label: name || fontFamily - }; - })]; - return Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], Object(esm_extends["a" /* default */])({ - label: Object(external_wp_i18n_["__"])('Font family'), - options: options, - value: value, - onChange: onChange, - labelPosition: "top" - }, props)); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/font-family.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - - - -const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily'; - -const getFontFamilyFromAttributeValue = (fontFamilies, value) => { - const attributeParsed = /var:preset\|font-family\|(.+)/.exec(value); - - if (attributeParsed && attributeParsed[1]) { - const fontFamilyObject = Object(external_lodash_["find"])(fontFamilies, ({ - slug - }) => { - return slug === attributeParsed[1]; - }); - - if (fontFamilyObject) { - return fontFamilyObject.fontFamily; - } - } - - return value; -}; - -function FontFamilyEdit({ - name, - setAttributes, - attributes: { - style = {} - } -}) { - var _style$typography; - - const fontFamilies = useSetting('typography.fontFamilies'); - const isDisable = useIsFontFamilyDisabled({ - name - }); - - if (isDisable) { - return null; - } - - const value = getFontFamilyFromAttributeValue(fontFamilies, (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.fontFamily); - - function onChange(newValue) { - const predefinedFontFamily = Object(external_lodash_["find"])(fontFamilies, ({ - fontFamily - }) => fontFamily === newValue); - setAttributes({ - style: cleanEmptyObject({ ...style, - typography: { ...(style.typography || {}), - fontFamily: predefinedFontFamily ? `var:preset|font-family|${predefinedFontFamily.slug}` : newValue || undefined - } - }) - }); - } - - return Object(external_wp_element_["createElement"])(FontFamilyControl, { - className: "block-editor-hooks-font-family-control", - fontFamilies: fontFamilies, - value: value, - onChange: onChange - }); -} -/** - * Custom hook that checks if font-family functionality is disabled. - * - * @param {string} name The name of the block. - * @return {boolean} Whether setting is disabled. - */ - -function useIsFontFamilyDisabled({ - name -}) { - const fontFamilies = useSetting('typography.fontFamilies'); - return !fontFamilies || fontFamilies.length === 0 || !Object(external_wp_blocks_["hasBlockSupport"])(name, FONT_FAMILY_SUPPORT_KEY); -} - -// EXTERNAL MODULE: external ["wp","tokenList"] -var external_wp_tokenList_ = __webpack_require__("BLeD"); -var external_wp_tokenList_default = /*#__PURE__*/__webpack_require__.n(external_wp_tokenList_); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-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 {?Object} 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. - */ - -const getFontSize = (fontSizes, fontSizeAttribute, customFontSizeAttribute) => { - if (fontSizeAttribute) { - const fontSizeObject = Object(external_lodash_["find"])(fontSizes, { - slug: fontSizeAttribute - }); - - if (fontSizeObject) { - return fontSizeObject; - } - } - - return { - size: customFontSizeAttribute - }; -}; -/** - * Returns the corresponding font size object for a given value. - * - * @param {Array} fontSizes Array of font size objects. - * @param {number} value Font size value. - * - * @return {Object} Font size object. - */ - -function getFontSizeObjectByValue(fontSizes, value) { - const fontSizeObject = Object(external_lodash_["find"])(fontSizes, { - size: value - }); - - if (fontSizeObject) { - return fontSizeObject; - } - - return { - size: value - }; -} -/** - * 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-${Object(external_lodash_["kebabCase"])(fontSizeSlug)}-font-size`; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/font-size-picker.js - - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - - -function FontSizePicker(props) { - const fontSizes = useSetting('typography.fontSizes'); - const disableCustomFontSizes = !useSetting('typography.customFontSize'); - return Object(external_wp_element_["createElement"])(external_wp_components_["FontSizePicker"], Object(esm_extends["a" /* default */])({}, props, { - fontSizes: fontSizes, - disableCustomFontSizes: disableCustomFontSizes - })); -} - -/* harmony default export */ var font_size_picker = (FontSizePicker); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/font-size.js - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - -const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize'; -/** - * Filters registered block settings, extending attributes to include - * `fontSize` and `fontWeight` attributes. - * - * @param {Object} settings Original block settings - * @return {Object} Filtered block settings - */ - -function font_size_addAttributes(settings) { - if (!Object(external_wp_blocks_["hasBlockSupport"])(settings, FONT_SIZE_SUPPORT_KEY)) { - return settings; - } // Allow blocks to specify a default value if needed. - - - if (!settings.attributes.fontSize) { - Object.assign(settings.attributes, { - fontSize: { - type: 'string' - } - }); - } - - return settings; -} -/** - * Override props assigned to save component to inject font size. - * - * @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 font_size_addSaveProps(props, blockType, attributes) { - if (!Object(external_wp_blocks_["hasBlockSupport"])(blockType, FONT_SIZE_SUPPORT_KEY)) { - return props; - } - - if (Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'typography.__experimentalSkipSerialization')) { - return props; - } // Use TokenList to dedupe classes. - - - const classes = new external_wp_tokenList_default.a(props.className); - classes.add(getFontSizeClass(attributes.fontSize)); - const newClassName = classes.value; - props.className = newClassName ? newClassName : undefined; - return props; -} -/** - * Filters registered block settings to expand the block edit wrapper - * by applying the desired styles and classnames. - * - * @param {Object} settings Original block settings - * @return {Object} Filtered block settings - */ - - -function font_size_addEditProps(settings) { - if (!Object(external_wp_blocks_["hasBlockSupport"])(settings, FONT_SIZE_SUPPORT_KEY)) { - return settings; - } - - const existingGetEditWrapperProps = settings.getEditWrapperProps; - - settings.getEditWrapperProps = attributes => { - let props = {}; - - if (existingGetEditWrapperProps) { - props = existingGetEditWrapperProps(attributes); - } - - return font_size_addSaveProps(props, settings, attributes); - }; - - return settings; -} -/** - * Inspector control panel containing the font size related configuration - * - * @param {Object} props - * - * @return {WPElement} Font size edit element. - */ - - -function FontSizeEdit(props) { - var _style$typography, _style$typography2; - - const { - attributes: { - fontSize, - style - }, - setAttributes - } = props; - const isDisabled = useIsFontSizeDisabled(props); - const fontSizes = useSetting('typography.fontSizes'); - - const onChange = value => { - const fontSizeSlug = getFontSizeObjectByValue(fontSizes, value).slug; - setAttributes({ - style: cleanEmptyObject({ ...style, - typography: { ...(style === null || style === void 0 ? void 0 : style.typography), - fontSize: fontSizeSlug ? undefined : value - } - }), - fontSize: fontSizeSlug - }); - }; - - if (isDisabled) { - return null; - } - - const fontSizeObject = getFontSize(fontSizes, fontSize, style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.fontSize); - const fontSizeValue = (fontSizeObject === null || fontSizeObject === void 0 ? void 0 : fontSizeObject.size) || (style === null || style === void 0 ? void 0 : (_style$typography2 = style.typography) === null || _style$typography2 === void 0 ? void 0 : _style$typography2.fontSize) || fontSize; - return Object(external_wp_element_["createElement"])(font_size_picker, { - onChange: onChange, - value: fontSizeValue - }); -} -/** - * Custom hook that checks if font-size settings have been disabled. - * - * @param {string} name The name of the block. - * @return {boolean} Whether setting is disabled. - */ - -function useIsFontSizeDisabled({ - name: blockName -} = {}) { - const fontSizes = useSetting('typography.fontSizes'); - const hasFontSizes = !!(fontSizes !== null && fontSizes !== void 0 && fontSizes.length); - return !Object(external_wp_blocks_["hasBlockSupport"])(blockName, FONT_SIZE_SUPPORT_KEY) || !hasFontSizes; -} -/** - * Add inline styles for font sizes. - * Ideally, this is not needed and themes load the font-size classes on the - * editor. - * - * @param {Function} BlockListBlock Original component - * @return {Function} Wrapped component - */ - -const withFontSizeInlineStyles = Object(external_wp_compose_["createHigherOrderComponent"])(BlockListBlock => props => { - var _style$typography3, _style$typography4; - - const fontSizes = useSetting('typography.fontSizes'); - const { - name: blockName, - attributes: { - fontSize, - style - }, - wrapperProps - } = props; // Only add inline styles if the block supports font sizes, - // doesn't skip serialization of font sizes, - // doesn't already have an inline font size, - // and does have a class to extract the font size from. - - if (!Object(external_wp_blocks_["hasBlockSupport"])(blockName, FONT_SIZE_SUPPORT_KEY) || Object(external_wp_blocks_["hasBlockSupport"])(blockName, 'typography.__experimentalSkipSerialization') || !fontSize || style !== null && style !== void 0 && (_style$typography3 = style.typography) !== null && _style$typography3 !== void 0 && _style$typography3.fontSize) { - return Object(external_wp_element_["createElement"])(BlockListBlock, props); - } - - const fontSizeValue = getFontSize(fontSizes, fontSize, style === null || style === void 0 ? void 0 : (_style$typography4 = style.typography) === null || _style$typography4 === void 0 ? void 0 : _style$typography4.fontSize).size; - const newProps = { ...props, - wrapperProps: { ...wrapperProps, - style: { - fontSize: fontSizeValue, - ...(wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.style) - } - } - }; - return Object(external_wp_element_["createElement"])(BlockListBlock, newProps); -}, 'withFontSizeInlineStyles'); -Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/font/addAttribute', font_size_addAttributes); -Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/font/addSaveProps', font_size_addSaveProps); -Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/font/addEditProps', font_size_addEditProps); -Object(external_wp_hooks_["addFilter"])('editor.BlockListBlock', 'core/font-size/with-font-size-inline-styles', withFontSizeInlineStyles); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/typography.js - - -/** - * WordPress dependencies - */ - -/** - * External dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - - - - - - -const TYPOGRAPHY_SUPPORT_KEY = 'typography'; -const TYPOGRAPHY_SUPPORT_KEYS = [LINE_HEIGHT_SUPPORT_KEY, FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, FONT_FAMILY_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY]; -function TypographyPanel(props) { - const isDisabled = useIsTypographyDisabled(props); - const isSupported = hasTypographySupport(props.name); - if (isDisabled || !isSupported) return null; - return Object(external_wp_element_["createElement"])(inspector_controls, null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { - title: Object(external_wp_i18n_["__"])('Typography') - }, Object(external_wp_element_["createElement"])(external_wp_components_["__unstableComponentSystemProvider"], { - __unstableNextInclude: ['WPComponentsFontSizePicker'] - }, Object(external_wp_element_["createElement"])(FontFamilyEdit, props), Object(external_wp_element_["createElement"])(FontSizeEdit, props), Object(external_wp_element_["createElement"])(FontAppearanceEdit, props), Object(external_wp_element_["createElement"])(LineHeightEdit, props), Object(external_wp_element_["createElement"])(TextDecorationAndTransformEdit, props)))); -} - -const hasTypographySupport = blockName => { - return external_wp_element_["Platform"].OS === 'web' && TYPOGRAPHY_SUPPORT_KEYS.some(key => Object(external_wp_blocks_["hasBlockSupport"])(blockName, key)); -}; - -function useIsTypographyDisabled(props = {}) { - const configs = [useIsFontAppearanceDisabled(props), useIsFontSizeDisabled(props), useIsLineHeightDisabled(props), useIsFontFamilyDisabled(props), useIsTextDecorationDisabled(props), useIsTextTransformDisabled(props)]; - return configs.filter(Boolean).length === configs.length; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/margin.js - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - -/** - * Determines if there is margin support. - * - * @param {string|Object} blockType Block name or Block Type object. - * @return {boolean} Whether there is support. - */ - -function hasMarginSupport(blockType) { - const support = Object(external_wp_blocks_["getBlockSupport"])(blockType, SPACING_SUPPORT_KEY); - return !!(true === support || support !== null && support !== void 0 && support.margin); -} -/** - * Custom hook that checks if margin settings have been disabled. - * - * @param {string} name The name of the block. - * @return {boolean} Whether margin setting is disabled. - */ - -function useIsMarginDisabled({ - name: blockName -} = {}) { - const isDisabled = !useSetting('spacing.customMargin'); - return !hasMarginSupport(blockName) || isDisabled; -} -/** - * Inspector control panel containing the margin related configuration - * - * @param {Object} props Block props. - * @return {WPElement} Margin edit element. - */ - -function MarginEdit(props) { - var _style$spacing; - - const { - name: blockName, - attributes: { - style - }, - setAttributes - } = props; - const units = Object(external_wp_components_["__experimentalUseCustomUnits"])({ - availableUnits: useSetting('spacing.units') || ['%', 'px', 'em', 'rem', 'vw'] - }); - const sides = useCustomSides(blockName, 'margin'); - - if (useIsMarginDisabled(props)) { - return null; - } - - const onChange = next => { - const newStyle = { ...style, - spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing), - margin: next - } - }; - setAttributes({ - style: cleanEmptyObject(newStyle) - }); - }; - - const onChangeShowVisualizer = next => { - const newStyle = { ...style, - visualizers: { - margin: next - } - }; - setAttributes({ - style: cleanEmptyObject(newStyle) - }); - }; - - return external_wp_element_["Platform"].select({ - web: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalBoxControl"], { - values: style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.margin, - onChange: onChange, - onChangeShowVisualizer: onChangeShowVisualizer, - label: Object(external_wp_i18n_["__"])('Margin'), - sides: sides, - units: units - })), - native: null - }); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/padding.js - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - -/** - * Determines if there is padding support. - * - * @param {string|Object} blockType Block name or Block Type object. - * @return {boolean} Whether there is support. - */ - -function hasPaddingSupport(blockType) { - const support = Object(external_wp_blocks_["getBlockSupport"])(blockType, SPACING_SUPPORT_KEY); - return !!(true === support || support !== null && support !== void 0 && support.padding); -} -/** - * Custom hook that checks if padding settings have been disabled. - * - * @param {string} name The name of the block. - * @return {boolean} Whether padding setting is disabled. - */ - -function useIsPaddingDisabled({ - name: blockName -} = {}) { - const isDisabled = !useSetting('spacing.customPadding'); - return !hasPaddingSupport(blockName) || isDisabled; -} -/** - * Inspector control panel containing the padding related configuration - * - * @param {Object} props - * - * @return {WPElement} Padding edit element. - */ - -function PaddingEdit(props) { - var _style$spacing; - - const { - name: blockName, - attributes: { - style - }, - setAttributes - } = props; - const units = Object(external_wp_components_["__experimentalUseCustomUnits"])({ - availableUnits: useSetting('spacing.units') || ['%', 'px', 'em', 'rem', 'vw'] - }); - const sides = useCustomSides(blockName, 'padding'); - - if (useIsPaddingDisabled(props)) { - return null; - } - - const onChange = next => { - const newStyle = { ...style, - spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing), - padding: next - } - }; - setAttributes({ - style: cleanEmptyObject(newStyle) - }); - }; - - const onChangeShowVisualizer = next => { - const newStyle = { ...style, - visualizers: { - padding: next - } - }; - setAttributes({ - style: cleanEmptyObject(newStyle) - }); - }; - - return external_wp_element_["Platform"].select({ - web: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalBoxControl"], { - values: style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.padding, - onChange: onChange, - onChangeShowVisualizer: onChangeShowVisualizer, - label: Object(external_wp_i18n_["__"])('Padding'), - sides: sides, - units: units - })), - native: null - }); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/spacing.js - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - -const SPACING_SUPPORT_KEY = 'spacing'; -/** - * Inspector controls for spacing support. - * - * @param {Object} props Block props. - * @return {WPElement} Inspector controls for spacing support features. - */ - -function SpacingPanel(props) { - const isDisabled = useIsSpacingDisabled(props); - const isSupported = hasSpacingSupport(props.name); - - if (isDisabled || !isSupported) { - return null; - } - - return Object(external_wp_element_["createElement"])(inspector_controls, { - key: "spacing" - }, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { - title: Object(external_wp_i18n_["__"])('Spacing') - }, Object(external_wp_element_["createElement"])(PaddingEdit, props), Object(external_wp_element_["createElement"])(MarginEdit, props))); -} -/** - * Determine whether there is block support for padding or margins. - * - * @param {string} blockName Block name. - * @return {boolean} Whether there is support. - */ - -function hasSpacingSupport(blockName) { - if (external_wp_element_["Platform"].OS !== 'web') { - return false; - } - - return hasPaddingSupport(blockName) || hasMarginSupport(blockName); -} -/** - * Determines whether spacing support has been disabled. - * - * @param {Object} props Block properties. - * @return {boolean} If spacing support is completely disabled. - */ - -const useIsSpacingDisabled = (props = {}) => { - const paddingDisabled = useIsPaddingDisabled(props); - const marginDisabled = useIsMarginDisabled(props); - return paddingDisabled && marginDisabled; -}; -/** - * Custom hook to retrieve which padding/margin is supported - * e.g. top, right, bottom or left. - * - * Sides are opted into by default. It is only if a specific side is set to - * false that it is omitted. - * - * @param {string} blockName Block name. - * @param {string} feature The feature custom sides relate to e.g. padding or margins. - * @return {Object} Sides supporting custom margin. - */ - - -function useCustomSides(blockName, feature) { - const support = Object(external_wp_blocks_["getBlockSupport"])(blockName, SPACING_SUPPORT_KEY); // Skip when setting is boolean as theme isn't setting arbitrary sides. - - if (typeof support[feature] === 'boolean') { - return; - } - - return support[feature]; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/style.js - - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - - - -const styleSupportKeys = [...TYPOGRAPHY_SUPPORT_KEYS, BORDER_SUPPORT_KEY, COLOR_SUPPORT_KEY, SPACING_SUPPORT_KEY]; - -const hasStyleSupport = blockType => styleSupportKeys.some(key => Object(external_wp_blocks_["hasBlockSupport"])(blockType, key)); - -const VARIABLE_REFERENCE_PREFIX = 'var:'; -const VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|'; -const VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--'; - -function compileStyleValue(uncompiledValue) { - if (Object(external_lodash_["startsWith"])(uncompiledValue, VARIABLE_REFERENCE_PREFIX)) { - const variable = uncompiledValue.slice(VARIABLE_REFERENCE_PREFIX.length).split(VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE).join(VARIABLE_PATH_SEPARATOR_TOKEN_STYLE); - return `var(--wp--${variable})`; - } - - return uncompiledValue; -} -/** - * Returns the inline styles to add depending on the style object - * - * @param {Object} styles Styles configuration - * @return {Object} Flattened CSS variables declaration - */ - - -function getInlineStyles(styles = {}) { - const output = {}; - Object.keys(external_wp_blocks_["__EXPERIMENTAL_STYLE_PROPERTY"]).forEach(propKey => { - const path = external_wp_blocks_["__EXPERIMENTAL_STYLE_PROPERTY"][propKey].value; - const subPaths = external_wp_blocks_["__EXPERIMENTAL_STYLE_PROPERTY"][propKey].properties; // Ignore styles on elements because they are handled on the server. - - if (Object(external_lodash_["has"])(styles, path) && 'elements' !== Object(external_lodash_["first"])(path)) { - if (!!subPaths) { - subPaths.forEach(suffix => { - output[propKey + Object(external_lodash_["capitalize"])(suffix)] = compileStyleValue(Object(external_lodash_["get"])(styles, [...path, suffix])); - }); - } else { - output[propKey] = compileStyleValue(Object(external_lodash_["get"])(styles, path)); - } - } - }); - return output; -} - -function compileElementsStyles(selector, elements = {}) { - return Object(external_lodash_["map"])(elements, (styles, element) => { - const elementStyles = getInlineStyles(styles); - - if (!Object(external_lodash_["isEmpty"])(elementStyles)) { - return [`.${selector} ${external_wp_blocks_["__EXPERIMENTAL_ELEMENTS"][element]}{`, ...Object(external_lodash_["map"])(elementStyles, (value, property) => `\t${Object(external_lodash_["kebabCase"])(property)}: ${value}${element === 'link' ? '!important' : ''};`), '}'].join('\n'); - } - - return ''; - }).join('\n'); -} -/** - * Filters registered block settings, extending attributes to include `style` attribute. - * - * @param {Object} settings Original block settings - * @return {Object} Filtered block settings - */ - - -function style_addAttribute(settings) { - if (!hasStyleSupport(settings)) { - return settings; - } // allow blocks to specify their own attribute definition with default values if needed. - - - if (!settings.attributes.style) { - Object.assign(settings.attributes, { - style: { - type: 'object' - } - }); - } - - return settings; -} - -const skipSerializationPaths = { - [`${BORDER_SUPPORT_KEY}.__experimentalSkipSerialization`]: ['border'], - [`${COLOR_SUPPORT_KEY}.__experimentalSkipSerialization`]: [COLOR_SUPPORT_KEY], - [`${TYPOGRAPHY_SUPPORT_KEY}.__experimentalSkipSerialization`]: [TYPOGRAPHY_SUPPORT_KEY] -}; -/** - * Override props assigned to save component to inject the CSS variables definition. - * - * @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 style_addSaveProps(props, blockType, attributes) { - if (!hasStyleSupport(blockType)) { - return props; - } - - let { - style - } = attributes; - Object(external_lodash_["forEach"])(skipSerializationPaths, (path, indicator) => { - if (Object(external_wp_blocks_["getBlockSupport"])(blockType, indicator)) { - style = Object(external_lodash_["omit"])(style, path); - } - }); - props.style = { ...getInlineStyles(style), - ...props.style - }; - return props; -} -/** - * Filters registered block settings to extend the block edit wrapper - * to apply the desired styles and classnames properly. - * - * @param {Object} settings Original block settings - * @return {Object} Filtered block settings - */ - -function style_addEditProps(settings) { - if (!hasStyleSupport(settings)) { - return settings; - } - - const existingGetEditWrapperProps = settings.getEditWrapperProps; - - settings.getEditWrapperProps = attributes => { - let props = {}; - - if (existingGetEditWrapperProps) { - props = existingGetEditWrapperProps(attributes); - } - - return style_addSaveProps(props, settings, attributes); - }; - - return settings; -} -/** - * Override the default edit UI to include new inspector controls for - * all the custom styles configs. - * - * @param {Function} BlockEdit Original component - * @return {Function} Wrapped component - */ - -const withBlockControls = Object(external_wp_compose_["createHigherOrderComponent"])(BlockEdit => props => { - const shouldDisplayControls = useDisplayBlockControls(); - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, shouldDisplayControls && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(TypographyPanel, props), Object(external_wp_element_["createElement"])(BorderPanel, props), Object(external_wp_element_["createElement"])(ColorEdit, props), Object(external_wp_element_["createElement"])(SpacingPanel, props)), Object(external_wp_element_["createElement"])(BlockEdit, props)); -}, 'withToolbarControls'); -/** - * Override the default block element to include duotone styles. - * - * @param {Function} BlockListBlock Original component - * @return {Function} Wrapped component - */ - -const withElementsStyles = Object(external_wp_compose_["createHigherOrderComponent"])(BlockListBlock => props => { - var _props$attributes$sty, _props$attributes$sty2; - - const elements = (_props$attributes$sty = props.attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : _props$attributes$sty.elements; - const blockElementsContainerIdentifier = `wp-elements-${Object(external_wp_compose_["useInstanceId"])(BlockListBlock)}`; - const styles = compileElementsStyles(blockElementsContainerIdentifier, (_props$attributes$sty2 = props.attributes.style) === null || _props$attributes$sty2 === void 0 ? void 0 : _props$attributes$sty2.elements); - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, elements && Object(external_wp_element_["createElement"])("style", { - dangerouslySetInnerHTML: { - __html: styles - } - }), Object(external_wp_element_["createElement"])(BlockListBlock, Object(esm_extends["a" /* default */])({}, props, { - className: elements ? classnames_default()(props.className, blockElementsContainerIdentifier) : props.className - }))); -}); -Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/style/addAttribute', style_addAttribute); -Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/style/addSaveProps', style_addSaveProps); -Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/style/addEditProps', style_addEditProps); -Object(external_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/style/with-block-controls', withBlockControls); -Object(external_wp_hooks_["addFilter"])('editor.BlockListBlock', 'core/editor/with-elements-styles', withElementsStyles); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/duotone-control/duotone-picker-popover.js - - -/** - * WordPress dependencies - */ - - - -function DuotonePickerPopover({ - value, - onChange, - onToggle, - duotonePalette, - colorPalette, - disableCustomColors, - disableCustomDuotone -}) { - return Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], { - className: "block-editor-duotone-control__popover", - headerTitle: Object(external_wp_i18n_["__"])('Duotone'), - onFocusOutside: onToggle - }, Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], { - label: Object(external_wp_i18n_["__"])('Duotone') - }, Object(external_wp_element_["createElement"])(external_wp_components_["DuotonePicker"], { - colorPalette: colorPalette, - duotonePalette: duotonePalette, - disableCustomColors: disableCustomColors, - disableCustomDuotone: disableCustomDuotone, - value: value, - onChange: onChange - }))); -} - -/* harmony default export */ var duotone_picker_popover = (DuotonePickerPopover); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/duotone-control/index.js - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - -function DuotoneControl({ - colorPalette, - duotonePalette, - disableCustomColors, - disableCustomDuotone, - value, - onChange -}) { - const [isOpen, setIsOpen] = Object(external_wp_element_["useState"])(false); - - const onToggle = () => { - setIsOpen(prev => !prev); - }; - - const openOnArrowDown = event => { - if (!isOpen && event.keyCode === external_wp_keycodes_["DOWN"]) { - event.preventDefault(); - event.stopPropagation(); - onToggle(); - } - }; - - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { - showTooltip: true, - onClick: onToggle, - "aria-haspopup": "true", - "aria-expanded": isOpen, - onKeyDown: openOnArrowDown, - label: Object(external_wp_i18n_["__"])('Apply duotone filter'), - icon: Object(external_wp_element_["createElement"])(external_wp_components_["DuotoneSwatch"], { - values: value - }) - }), isOpen && Object(external_wp_element_["createElement"])(duotone_picker_popover, { - value: value, - onChange: onChange, - onToggle: onToggle, - duotonePalette: duotonePalette, - colorPalette: colorPalette, - disableCustomColors: disableCustomColors, - disableCustomDuotone: disableCustomDuotone - })); -} - -/* harmony default export */ var duotone_control = (DuotoneControl); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/head.js - - -/** - * WordPress dependencies - */ - -const head_context = Object(external_wp_element_["createContext"])(); -function Head({ - children -}) { - const [element, setElement] = Object(external_wp_element_["useState"])(); - return Object(external_wp_element_["createElement"])(head_context.Provider, { - value: element - }, Object(external_wp_element_["createElement"])("div", { - ref: setElement - }), children); -} -Head.context = head_context; - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/duotone.js - - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - -const duotone_EMPTY_ARRAY = []; -/** - * Convert a list of colors to an object of R, G, and B values. - * - * @param {string[]} colors Array of RBG color strings. - * - * @return {Object} R, G, and B values. - */ - -function getValuesFromColors(colors = []) { - const values = { - r: [], - g: [], - b: [] - }; - colors.forEach(color => { - // Access values directly to skip extra rounding that tinycolor.toRgb() does. - const tcolor = tinycolor_default()(color); - values.r.push(tcolor._r / 255); - values.g.push(tcolor._g / 255); - values.b.push(tcolor._b / 255); - }); - return values; -} -/** - * Values for the SVG `feComponentTransfer`. - * - * @typedef Values {Object} - * @property {number[]} r Red values. - * @property {number[]} g Green values. - * @property {number[]} b Blue values. - */ - -/** - * SVG and stylesheet needed for rendering the duotone filter. - * - * @param {Object} props Duotone props. - * @param {string} props.selector Selector to apply the filter to. - * @param {string} props.id Unique id for this duotone filter. - * @param {Values} props.values R, G, and B values to filter with. - * @return {WPElement} Duotone element. - */ - -function DuotoneFilter({ - selector, - id, - values -}) { - const stylesheet = ` -${selector} { - filter: url( #${id} ); -} -`; - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { - xmlnsXlink: "http://www.w3.org/1999/xlink", - viewBox: "0 0 0 0", - width: "0", - height: "0", - focusable: "false", - role: "none", - style: { - visibility: 'hidden', - position: 'absolute', - left: '-9999px', - overflow: 'hidden' - } - }, Object(external_wp_element_["createElement"])("defs", null, Object(external_wp_element_["createElement"])("filter", { - id: id - }, Object(external_wp_element_["createElement"])("feColorMatrix", { - type: "matrix" // Use perceptual brightness to convert to grayscale. - // prettier-ignore - , - values: ".299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 0 0 0 1 0" - }), Object(external_wp_element_["createElement"])("feComponentTransfer", { - // Use sRGB instead of linearRGB to be consistent with how CSS gradients work. - colorInterpolationFilters: "sRGB" - }, Object(external_wp_element_["createElement"])("feFuncR", { - type: "table", - tableValues: values.r.join(' ') - }), Object(external_wp_element_["createElement"])("feFuncG", { - type: "table", - tableValues: values.g.join(' ') - }), Object(external_wp_element_["createElement"])("feFuncB", { - type: "table", - tableValues: values.b.join(' ') - }))))), Object(external_wp_element_["createElement"])("style", { - dangerouslySetInnerHTML: { - __html: stylesheet - } - })); -} - -function DuotonePanel({ - attributes, - setAttributes -}) { - var _style$color; - - const style = attributes === null || attributes === void 0 ? void 0 : attributes.style; - const duotone = style === null || style === void 0 ? void 0 : (_style$color = style.color) === null || _style$color === void 0 ? void 0 : _style$color.duotone; - const duotonePalette = useSetting('color.duotone') || duotone_EMPTY_ARRAY; - const colorPalette = useSetting('color.palette') || duotone_EMPTY_ARRAY; - const disableCustomColors = !useSetting('color.custom'); - const disableCustomDuotone = !useSetting('color.customDuotone') || (colorPalette === null || colorPalette === void 0 ? void 0 : colorPalette.length) === 0 && disableCustomColors; - - if ((duotonePalette === null || duotonePalette === void 0 ? void 0 : duotonePalette.length) === 0 && disableCustomDuotone) { - return null; - } - - return Object(external_wp_element_["createElement"])(block_controls, { - group: "block" - }, Object(external_wp_element_["createElement"])(duotone_control, { - duotonePalette: duotonePalette, - colorPalette: colorPalette, - disableCustomDuotone: disableCustomDuotone, - disableCustomColors: disableCustomColors, - value: duotone, - onChange: newDuotone => { - const newStyle = { ...style, - color: { ...(style === null || style === void 0 ? void 0 : style.color), - duotone: newDuotone - } - }; - setAttributes({ - style: newStyle - }); - } - })); -} -/** - * Filters registered block settings, extending attributes to include - * the `duotone` attribute. - * - * @param {Object} settings Original block settings - * @return {Object} Filtered block settings - */ - - -function addDuotoneAttributes(settings) { - if (!Object(external_wp_blocks_["hasBlockSupport"])(settings, 'color.__experimentalDuotone')) { - return settings; - } // Allow blocks to specify their own attribute definition with default - // values if needed. - - - if (!settings.attributes.style) { - Object.assign(settings.attributes, { - style: { - type: 'object' - } - }); - } - - return settings; -} -/** - * Override the default edit UI to include toolbar controls for duotone if the - * block supports duotone. - * - * @param {Function} BlockEdit Original component - * @return {Function} Wrapped component - */ - - -const withDuotoneControls = Object(external_wp_compose_["createHigherOrderComponent"])(BlockEdit => props => { - const hasDuotoneSupport = Object(external_wp_blocks_["hasBlockSupport"])(props.name, 'color.__experimentalDuotone'); - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(BlockEdit, props), hasDuotoneSupport && Object(external_wp_element_["createElement"])(DuotonePanel, props)); -}, 'withDuotoneControls'); -/** - * Override the default block element to include duotone styles. - * - * @param {Function} BlockListBlock Original component - * @return {Function} Wrapped component - */ - -const withDuotoneStyles = Object(external_wp_compose_["createHigherOrderComponent"])(BlockListBlock => props => { - var _props$attributes, _props$attributes$sty, _props$attributes$sty2; - - const duotoneSupport = Object(external_wp_blocks_["getBlockSupport"])(props.name, 'color.__experimentalDuotone'); - const values = props === null || props === void 0 ? void 0 : (_props$attributes = props.attributes) === null || _props$attributes === void 0 ? void 0 : (_props$attributes$sty = _props$attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : (_props$attributes$sty2 = _props$attributes$sty.color) === null || _props$attributes$sty2 === void 0 ? void 0 : _props$attributes$sty2.duotone; - - if (!duotoneSupport || !values) { - return Object(external_wp_element_["createElement"])(BlockListBlock, props); - } - - const id = `wp-duotone-filter-${Object(external_wp_compose_["useInstanceId"])(BlockListBlock)}`; - const selectors = duotoneSupport.split(','); - const selectorsScoped = selectors.map(selector => `.${id} ${selector.trim()}`); - const selectorsGroup = selectorsScoped.join(', '); - const className = classnames_default()(props === null || props === void 0 ? void 0 : props.className, id); - const element = Object(external_wp_element_["useContext"])(Head.context); - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, element && Object(external_wp_element_["createPortal"])(Object(external_wp_element_["createElement"])(DuotoneFilter, { - selector: selectorsGroup, - id: id, - values: getValuesFromColors(values) - }), element), Object(external_wp_element_["createElement"])(BlockListBlock, Object(esm_extends["a" /* default */])({}, props, { - className: className - }))); -}, 'withDuotoneStyles'); -Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/editor/duotone/add-attributes', addDuotoneAttributes); -Object(external_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/editor/duotone/with-editor-controls', withDuotoneControls); -Object(external_wp_hooks_["addFilter"])('editor.BlockListBlock', 'core/editor/duotone/with-styles', withDuotoneStyles); - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js -var build_module_icon = __webpack_require__("iClF"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/layout.js - - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - - - - - - -/** - * Internal dependencies - */ - - - - - - - -function LayoutPanel({ - setAttributes, - attributes -}) { - const { - layout = {} - } = attributes; - const { - wideSize, - contentSize, - inherit = false - } = layout; - const defaultLayout = useSetting('layout'); - const themeSupportsLayout = Object(external_wp_data_["useSelect"])(select => { - const { - getSettings - } = select(store); - return getSettings().supportsLayout; - }, []); - const units = Object(external_wp_components_["__experimentalUseCustomUnits"])({ - availableUnits: useSetting('spacing.units') || ['%', 'px', 'em', 'rem', 'vw'] - }); - - if (!themeSupportsLayout) { - return null; - } - - return Object(external_wp_element_["createElement"])(inspector_controls, null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { - title: Object(external_wp_i18n_["__"])('Layout') - }, !!defaultLayout && Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { - label: Object(external_wp_i18n_["__"])('Inherit default layout'), - checked: !!inherit, - onChange: () => setAttributes({ - layout: { - inherit: !inherit - } - }) - }), !inherit && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-hooks__layout-controls" - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-hooks__layout-controls-unit" - }, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalUnitControl"], { - label: Object(external_wp_i18n_["__"])('Content'), - labelPosition: "top", - __unstableInputWidth: "80px", - value: contentSize || wideSize || '', - onChange: nextWidth => { - nextWidth = 0 > parseFloat(nextWidth) ? '0' : nextWidth; - setAttributes({ - layout: { ...layout, - contentSize: nextWidth - } - }); - }, - units: units - }), Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { - icon: position_center - })), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-hooks__layout-controls-unit" - }, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalUnitControl"], { - label: Object(external_wp_i18n_["__"])('Wide'), - labelPosition: "top", - __unstableInputWidth: "80px", - value: wideSize || contentSize || '', - onChange: nextWidth => { - nextWidth = 0 > parseFloat(nextWidth) ? '0' : nextWidth; - setAttributes({ - layout: { ...layout, - wideSize: nextWidth - } - }); - }, - units: units - }), Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { - icon: stretch_wide - }))), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-hooks__layout-controls-reset" - }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - isSecondary: true, - isSmall: true, - disabled: !contentSize && !wideSize, - onClick: () => setAttributes({ - layout: { - contentSize: undefined, - wideSize: undefined, - inherit: false - } - }) - }, Object(external_wp_i18n_["__"])('Reset')))), Object(external_wp_element_["createElement"])("p", { - className: "block-editor-hooks__layout-controls-helptext" - }, Object(external_wp_i18n_["__"])('Customize the width for all elements that are assigned to the center or wide columns.')))); -} -/** - * Filters registered block settings, extending attributes to include `layout`. - * - * @param {Object} settings Original block settings - * @return {Object} Filtered block settings - */ - - -function layout_addAttribute(settings) { - if (Object(external_lodash_["has"])(settings.attributes, ['layout', 'type'])) { - return settings; - } - - if (Object(external_wp_blocks_["hasBlockSupport"])(settings, '__experimentalLayout')) { - settings.attributes = { ...settings.attributes, - layout: { - type: 'object' - } - }; - } - - return settings; -} -/** - * Override the default edit UI to include layout controls - * - * @param {Function} BlockEdit Original component - * @return {Function} Wrapped component - */ - -const withInspectorControls = Object(external_wp_compose_["createHigherOrderComponent"])(BlockEdit => props => { - const { - name: blockName - } = props; - const supportLayout = Object(external_wp_blocks_["hasBlockSupport"])(blockName, '__experimentalLayout'); - return [supportLayout && Object(external_wp_element_["createElement"])(LayoutPanel, Object(esm_extends["a" /* default */])({ - key: "layout" - }, props)), Object(external_wp_element_["createElement"])(BlockEdit, Object(esm_extends["a" /* default */])({ - key: "edit" - }, props))]; -}, 'withInspectorControls'); -/** - * Override the default block element to add the layout styles. - * - * @param {Function} BlockListBlock Original component - * @return {Function} Wrapped component - */ - -const withLayoutStyles = Object(external_wp_compose_["createHigherOrderComponent"])(BlockListBlock => props => { - const { - name, - attributes - } = props; - const supportLayout = Object(external_wp_blocks_["hasBlockSupport"])(name, '__experimentalLayout'); - const id = Object(external_wp_compose_["useInstanceId"])(BlockListBlock); - const defaultLayout = useSetting('layout') || {}; - - if (!supportLayout) { - return Object(external_wp_element_["createElement"])(BlockListBlock, props); - } - - const { - layout = {} - } = attributes; - const usedLayout = !!layout && layout.inherit ? defaultLayout : layout; - const className = classnames_default()(props === null || props === void 0 ? void 0 : props.className, `wp-container-${id}`); - const element = Object(external_wp_element_["useContext"])(Head.context); - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, element && Object(external_wp_element_["createPortal"])(Object(external_wp_element_["createElement"])(LayoutStyle, { - selector: `.wp-container-${id}`, - layout: usedLayout - }), element), Object(external_wp_element_["createElement"])(BlockListBlock, Object(esm_extends["a" /* default */])({}, props, { - className: className - }))); -}); -Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/layout/addAttribute', layout_addAttribute); -Object(external_wp_hooks_["addFilter"])('editor.BlockListBlock', 'core/editor/layout/with-layout-styles', withLayoutStyles); -Object(external_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/editor/layout/with-inspector-controls', withInspectorControls); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-border-props.js -/** - * External dependencies - */ - -/** - * Internal dependencies - */ - - - - // This utility is intended to assist where the serialization of the border -// block support is being skipped for a block but the border related CSS classes -// & styles still need to be generated so they can be applied to inner elements. - -const use_border_props_EMPTY_ARRAY = []; -/** - * Provides the CSS class names and inline styles for a block's border support - * attributes. - * - * @param {Object} attributes Block attributes. - * @param {string} attributes.borderColor Selected named border color. - * @param {Object} attributes.style Block's styles attribute. - * - * @return {Object} Border block support derived CSS classes & styles. - */ - -function getBorderClassesAndStyles({ - borderColor, - style -}) { - var _style$border; - - const borderStyles = (style === null || style === void 0 ? void 0 : style.border) || {}; - const borderClass = getColorClassName('border-color', borderColor); - const className = classnames_default()({ - [borderClass]: !!borderClass, - 'has-border-color': borderColor || (style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.color) - }); - return { - className: className || undefined, - style: getInlineStyles({ - border: borderStyles - }) - }; -} -/** - * Derives the border related props for a block from its border block support - * attributes. - * - * Inline styles are forced for named colors to ensure these selections are - * reflected when themes do not load their color stylesheets in the editor. - * - * @param {Object} attributes Block attributes. - * @return {Object} ClassName & style props from border block support. - */ - -function useBorderProps(attributes) { - const colors = useSetting('color.palette') || use_border_props_EMPTY_ARRAY; - const borderProps = getBorderClassesAndStyles(attributes); // Force inline style to apply border color when themes do not load their - // color stylesheets in the editor. - - if (attributes.borderColor) { - const borderColorObject = getColorObjectByAttributeValues(colors, attributes.borderColor); - borderProps.style.borderColor = borderColorObject.color; - } - - return borderProps; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-color-props.js -/** - * External dependencies - */ - -/** - * Internal dependencies - */ - - - - - // The code in this file has largely been lifted from the color block support -// hook. -// -// This utility is intended to assist where the serialization of the colors -// block support is being skipped for a block but the color related CSS classes -// & styles still need to be generated so they can be applied to inner elements. - -const use_color_props_EMPTY_ARRAY = []; -/** - * Provides the CSS class names and inline styles for a block's color support - * attributes. - * - * @param {Object} attributes Block attributes. - * @return {Object} Color block support derived CSS classes & styles. - */ - -function getColorClassesAndStyles(attributes) { - var _style$color, _style$color2, _style$color3, _style$color4, _style$elements, _style$elements$link; - - const { - backgroundColor, - textColor, - gradient, - style - } = attributes; // Collect color CSS classes. - - const backgroundClass = getColorClassName('background-color', backgroundColor); - const textClass = getColorClassName('color', textColor); - - const gradientClass = __experimentalGetGradientClass(gradient); - - const hasGradient = gradientClass || (style === null || style === void 0 ? void 0 : (_style$color = style.color) === null || _style$color === void 0 ? void 0 : _style$color.gradient); // Determine color CSS class name list. - - const className = classnames_default()(textClass, gradientClass, { - // Don't apply the background class if there's a gradient. - [backgroundClass]: !hasGradient && !!backgroundClass, - 'has-text-color': textColor || (style === null || style === void 0 ? void 0 : (_style$color2 = style.color) === null || _style$color2 === void 0 ? void 0 : _style$color2.text), - 'has-background': backgroundColor || (style === null || style === void 0 ? void 0 : (_style$color3 = style.color) === null || _style$color3 === void 0 ? void 0 : _style$color3.background) || gradient || (style === null || style === void 0 ? void 0 : (_style$color4 = style.color) === null || _style$color4 === void 0 ? void 0 : _style$color4.gradient), - 'has-link-color': style === null || style === void 0 ? void 0 : (_style$elements = style.elements) === null || _style$elements === void 0 ? void 0 : (_style$elements$link = _style$elements.link) === null || _style$elements$link === void 0 ? void 0 : _style$elements$link.color - }); // Collect inline styles for colors. - - const colorStyles = (style === null || style === void 0 ? void 0 : style.color) || {}; - const styleProp = getInlineStyles({ - color: colorStyles - }); - return { - className: className || undefined, - style: styleProp - }; -} -/** - * Determines the color related props for a block derived from its color block - * support attributes. - * - * Inline styles are forced for named colors to ensure these selections are - * reflected when themes do not load their color stylesheets in the editor. - * - * @param {Object} attributes Block attributes. - * @return {Object} ClassName & style props from colors block support. - */ - -function useColorProps(attributes) { - const { - backgroundColor, - textColor, - gradient - } = attributes; - const colors = useSetting('color.palette') || use_color_props_EMPTY_ARRAY; - const gradients = useSetting('color.gradients') || use_color_props_EMPTY_ARRAY; - const colorProps = getColorClassesAndStyles(attributes); // Force inline styles to apply colors when themes do not load their color - // stylesheets in the editor. - - if (backgroundColor) { - const backgroundColorObject = getColorObjectByAttributeValues(colors, backgroundColor); - colorProps.style.backgroundColor = backgroundColorObject.color; - } - - if (gradient) { - colorProps.style.background = getGradientValueBySlug(gradients, gradient); - } - - if (textColor) { - const textColorObject = getColorObjectByAttributeValues(colors, textColor); - colorProps.style.color = textColorObject.color; - } - - return colorProps; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/index.js -/** - * Internal dependencies - */ - - - - - - - - - - - - - - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/with-colors.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - -const DEFAULT_COLORS = []; -/** - * Higher order component factory for injecting the `colorsArray` argument as - * the colors prop in the `withCustomColors` HOC. - * - * @param {Array} colorsArray An array of color objects. - * - * @return {Function} The higher order component. - */ - -const withCustomColorPalette = colorsArray => Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => props => Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, props, { - colors: colorsArray -})), 'withCustomColorPalette'); -/** - * Higher order component factory for injecting the editor colors as the - * `colors` prop in the `withColors` HOC. - * - * @return {Function} The higher order component. - */ - - -const withEditorColorPalette = () => Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => props => { - const colors = useSetting('color.palette') || DEFAULT_COLORS; - return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, props, { - colors: colors - })); -}, 'withEditorColorPalette'); -/** - * Helper function used with `createHigherOrderComponent` to create - * higher order components for managing color logic. - * - * @param {Array} colorTypes An array of color types (e.g. 'backgroundColor, borderColor). - * @param {Function} withColorPalette A HOC for injecting the 'colors' prop into the WrappedComponent. - * - * @return {WPComponent} The component that can be used as a HOC. - */ - - -function createColorHOC(colorTypes, withColorPalette) { - const colorMap = Object(external_lodash_["reduce"])(colorTypes, (colorObject, colorType) => { - return { ...colorObject, - ...(Object(external_lodash_["isString"])(colorType) ? { - [colorType]: Object(external_lodash_["kebabCase"])(colorType) - } : colorType) - }; - }, {}); - return Object(external_wp_compose_["compose"])([withColorPalette, WrappedComponent => { - return class extends external_wp_element_["Component"] { - constructor(props) { - super(props); - this.setters = this.createSetters(); - this.colorUtils = { - getMostReadableColor: this.getMostReadableColor.bind(this) - }; - this.state = {}; - } - - getMostReadableColor(colorValue) { - const { - colors - } = this.props; - return getMostReadableColor(colors, colorValue); - } - - createSetters() { - return Object(external_lodash_["reduce"])(colorMap, (settersAccumulator, colorContext, colorAttributeName) => { - const upperFirstColorAttributeName = Object(external_lodash_["upperFirst"])(colorAttributeName); - const customColorAttributeName = `custom${upperFirstColorAttributeName}`; - settersAccumulator[`set${upperFirstColorAttributeName}`] = this.createSetColor(colorAttributeName, customColorAttributeName); - return settersAccumulator; - }, {}); - } - - createSetColor(colorAttributeName, customColorAttributeName) { - return colorValue => { - const colorObject = getColorObjectByColorValue(this.props.colors, colorValue); - this.props.setAttributes({ - [colorAttributeName]: colorObject && colorObject.slug ? colorObject.slug : undefined, - [customColorAttributeName]: colorObject && colorObject.slug ? undefined : colorValue - }); - }; - } - - static getDerivedStateFromProps({ - attributes, - colors - }, previousState) { - return Object(external_lodash_["reduce"])(colorMap, (newState, colorContext, colorAttributeName) => { - const colorObject = getColorObjectByAttributeValues(colors, attributes[colorAttributeName], attributes[`custom${Object(external_lodash_["upperFirst"])(colorAttributeName)}`]); - const previousColorObject = previousState[colorAttributeName]; - const previousColor = previousColorObject === null || previousColorObject === void 0 ? void 0 : 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] = { ...colorObject, - class: getColorClassName(colorContext, colorObject.slug) - }; - } - - return newState; - }, {}); - } - - render() { - return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, this.props, { - colors: undefined - }, this.state, this.setters, { - colorUtils: this.colorUtils - })); - } - - }; - }]); -} -/** - * A higher-order component factory for creating a 'withCustomColors' HOC, which handles color logic - * for class generation color value, retrieval and color attribute setting. - * - * Use this higher-order component to work with a custom set of colors. - * - * @example - * - * ```jsx - * const CUSTOM_COLORS = [ { name: 'Red', slug: 'red', color: '#ff0000' }, { name: 'Blue', slug: 'blue', color: '#0000ff' } ]; - * const withCustomColors = createCustomColorsHOC( CUSTOM_COLORS ); - * // ... - * export default compose( - * withCustomColors( 'backgroundColor', 'borderColor' ), - * MyColorfulComponent, - * ); - * ``` - * - * @param {Array} colorsArray The array of color objects (name, slug, color, etc... ). - * - * @return {Function} Higher-order component. - */ - - -function createCustomColorsHOC(colorsArray) { - return (...colorTypes) => { - const withColorPalette = withCustomColorPalette(colorsArray); - return Object(external_wp_compose_["createHigherOrderComponent"])(createColorHOC(colorTypes, withColorPalette), 'withCustomColors'); - }; -} -/** - * A higher-order component, which handles color logic for class generation color value, retrieval and color attribute setting. - * - * For use with the default editor/theme color palette. - * - * @example - * - * ```jsx - * export default compose( - * withColors( 'backgroundColor', { textColor: 'color' } ), - * MyColorfulComponent, - * ); - * ``` - * - * @param {...(Object|string)} colorTypes 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. - */ - -function withColors(...colorTypes) { - const withColorPalette = withEditorColorPalette(); - return Object(external_wp_compose_["createHigherOrderComponent"])(createColorHOC(colorTypes, withColorPalette), 'withColors'); -} - -// EXTERNAL MODULE: ./node_modules/memize/index.js -var memize = __webpack_require__("4eJC"); -var memize_default = /*#__PURE__*/__webpack_require__.n(memize); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/panel-color-settings/index.js - - - -/** - * Internal dependencies - */ - - -const PanelColorSettings = ({ - colorSettings, - ...props -}) => { - const settings = colorSettings.map(({ - value, - onChange, - ...otherSettings - }) => ({ ...otherSettings, - colorValue: value, - onColorChange: onChange - })); - return Object(external_wp_element_["createElement"])(panel_color_gradient_settings, Object(esm_extends["a" /* default */])({ - settings: settings, - gradients: [], - disableCustomGradients: true - }, props)); -}; - -/* harmony default export */ var panel_color_settings = (PanelColorSettings); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/color-panel.js - - - -/** - * External dependencies - */ - -/** - * Internal dependencies - */ - - - - -const resolveContrastCheckerColor = (color, colorSettings, detectedColor) => { - if (typeof color === 'function') { - return color(colorSettings); - } else if (color === true) { - return detectedColor; - } - - return color; -}; - -function color_panel_ColorPanel({ - title, - colorSettings, - colorPanelProps, - contrastCheckers, - detectedBackgroundColor, - detectedColor, - panelChildren, - initialOpen -}) { - return Object(external_wp_element_["createElement"])(panel_color_settings, Object(esm_extends["a" /* default */])({ - title: title, - initialOpen: initialOpen, - colorSettings: Object.values(colorSettings) - }, colorPanelProps), contrastCheckers && (Array.isArray(contrastCheckers) ? contrastCheckers.map(({ - backgroundColor, - textColor, - ...rest - }) => { - backgroundColor = resolveContrastCheckerColor(backgroundColor, colorSettings, detectedBackgroundColor); - textColor = resolveContrastCheckerColor(textColor, colorSettings, detectedColor); - return Object(external_wp_element_["createElement"])(contrast_checker, Object(esm_extends["a" /* default */])({ - key: `${backgroundColor}-${textColor}`, - backgroundColor: backgroundColor, - textColor: textColor - }, rest)); - }) : Object(external_lodash_["map"])(colorSettings, ({ - value - }) => { - let { - backgroundColor, - textColor - } = contrastCheckers; - backgroundColor = resolveContrastCheckerColor(backgroundColor || value, colorSettings, detectedBackgroundColor); - textColor = resolveContrastCheckerColor(textColor || value, colorSettings, detectedColor); - return Object(external_wp_element_["createElement"])(contrast_checker, Object(esm_extends["a" /* default */])({}, contrastCheckers, { - key: `${backgroundColor}-${textColor}`, - backgroundColor: backgroundColor, - textColor: textColor - })); - })), typeof panelChildren === 'function' ? panelChildren(colorSettings) : panelChildren); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/use-colors.js - - -/** - * External dependencies - */ - - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - - - - -function use_colors_getComputedStyle(node) { - return node.ownerDocument.defaultView.getComputedStyle(node); -} - -const use_colors_DEFAULT_COLORS = []; -const COMMON_COLOR_LABELS = { - textColor: Object(external_wp_i18n_["__"])('Text color'), - backgroundColor: Object(external_wp_i18n_["__"])('Background color') -}; - -const InspectorControlsColorPanel = props => Object(external_wp_element_["createElement"])(inspector_controls, null, Object(external_wp_element_["createElement"])(color_panel_ColorPanel, props)); - -function __experimentalUseColors(colorConfigs, { - panelTitle = Object(external_wp_i18n_["__"])('Color'), - colorPanelProps, - contrastCheckers, - panelChildren, - colorDetector: { - targetRef, - backgroundColorTargetRef = targetRef, - textColorTargetRef = targetRef - } = {} -} = { - panelTitle: Object(external_wp_i18n_["__"])('Color') -}, deps = []) { - const { - clientId - } = useBlockEditContext(); - const settingsColors = useSetting('color.palette') || use_colors_DEFAULT_COLORS; - const { - attributes - } = Object(external_wp_data_["useSelect"])(select => { - const { - getBlockAttributes - } = select(store); - return { - attributes: getBlockAttributes(clientId) - }; - }, [clientId]); - const { - updateBlockAttributes - } = Object(external_wp_data_["useDispatch"])(store); - const setAttributes = Object(external_wp_element_["useCallback"])(newAttributes => updateBlockAttributes(clientId, newAttributes), [updateBlockAttributes, clientId]); - const createComponent = Object(external_wp_element_["useMemo"])(() => memize_default()((name, property, className, color, colorValue, customColor) => ({ - children, - className: componentClassName = '', - style: componentStyle = {} - }) => { - let colorStyle = {}; - - if (color) { - colorStyle = { - [property]: colorValue - }; - } else if (customColor) { - colorStyle = { - [property]: customColor - }; - } - - const extraProps = { - className: classnames_default()(componentClassName, { - [`has-${Object(external_lodash_["kebabCase"])(color)}-${Object(external_lodash_["kebabCase"])(property)}`]: color, - [className || `has-${Object(external_lodash_["kebabCase"])(name)}`]: color || customColor - }), - style: { ...colorStyle, - ...componentStyle - } - }; - - if (Object(external_lodash_["isFunction"])(children)) { - return children(extraProps); - } - - return (// Clone children, setting the style property from the color configuration, - // if not already set explicitly through props. - external_wp_element_["Children"].map(children, child => { - return Object(external_wp_element_["cloneElement"])(child, { - className: classnames_default()(child.props.className, extraProps.className), - style: { ...extraProps.style, - ...(child.props.style || {}) - } - }); - }) - ); - }, { - maxSize: colorConfigs.length - }), [colorConfigs.length]); - const createSetColor = Object(external_wp_element_["useMemo"])(() => memize_default()((name, colors) => newColor => { - const color = colors.find(_color => _color.color === newColor); - setAttributes({ - [color ? Object(external_lodash_["camelCase"])(`custom ${name}`) : name]: undefined - }); - setAttributes({ - [color ? name : Object(external_lodash_["camelCase"])(`custom ${name}`)]: color ? color.slug : newColor - }); - }, { - maxSize: colorConfigs.length - }), [setAttributes, colorConfigs.length]); - const [detectedBackgroundColor, setDetectedBackgroundColor] = Object(external_wp_element_["useState"])(); - const [detectedColor, setDetectedColor] = Object(external_wp_element_["useState"])(); - Object(external_wp_element_["useEffect"])(() => { - if (!contrastCheckers) { - return undefined; - } - - let needsBackgroundColor = false; - let needsColor = false; - - for (const { - backgroundColor, - textColor - } of Object(external_lodash_["castArray"])(contrastCheckers)) { - if (!needsBackgroundColor) { - needsBackgroundColor = backgroundColor === true; - } - - if (!needsColor) { - needsColor = textColor === true; - } - - if (needsBackgroundColor && needsColor) { - break; - } - } - - if (needsColor) { - setDetectedColor(use_colors_getComputedStyle(textColorTargetRef.current).color); - } - - if (needsBackgroundColor) { - let backgroundColorNode = backgroundColorTargetRef.current; - let backgroundColor = use_colors_getComputedStyle(backgroundColorNode).backgroundColor; - - while (backgroundColor === 'rgba(0, 0, 0, 0)' && backgroundColorNode.parentNode && backgroundColorNode.parentNode.nodeType === backgroundColorNode.parentNode.ELEMENT_NODE) { - backgroundColorNode = backgroundColorNode.parentNode; - backgroundColor = use_colors_getComputedStyle(backgroundColorNode).backgroundColor; - } - - setDetectedBackgroundColor(backgroundColor); - } - }, [colorConfigs.reduce((acc, colorConfig) => `${acc} | ${attributes[colorConfig.name]} | ${attributes[Object(external_lodash_["camelCase"])(`custom ${colorConfig.name}`)]}`, ''), ...deps]); - return Object(external_wp_element_["useMemo"])(() => { - const colorSettings = {}; - const components = colorConfigs.reduce((acc, colorConfig) => { - if (typeof colorConfig === 'string') { - colorConfig = { - name: colorConfig - }; - } - - const { - name, - // E.g. 'backgroundColor'. - property = name, - // E.g. 'backgroundColor'. - className, - panelLabel = colorConfig.label || COMMON_COLOR_LABELS[name] || Object(external_lodash_["startCase"])(name), - // E.g. 'Background color'. - componentName = Object(external_lodash_["startCase"])(name).replace(/\s/g, ''), - // E.g. 'BackgroundColor'. - color = colorConfig.color, - colors = settingsColors - } = { ...colorConfig, - color: attributes[colorConfig.name] - }; - const customColor = attributes[Object(external_lodash_["camelCase"])(`custom ${name}`)]; // We memoize the non-primitives to avoid unnecessary updates - // when they are used as props for other components. - - const _color = customColor ? undefined : colors.find(__color => __color.slug === color); - - acc[componentName] = createComponent(name, property, className, color, _color && _color.color, customColor); - acc[componentName].displayName = componentName; - acc[componentName].color = customColor ? customColor : _color && _color.color; - acc[componentName].slug = color; - acc[componentName].setColor = createSetColor(name, colors); - colorSettings[componentName] = { - value: _color ? _color.color : attributes[Object(external_lodash_["camelCase"])(`custom ${name}`)], - onChange: acc[componentName].setColor, - label: panelLabel, - colors - }; // These settings will be spread over the `colors` in - // `colorPanelProps`, so we need to unset the key here, - // if not set to an actual value, to avoid overwriting - // an actual value in `colorPanelProps`. - - if (!colors) { - delete colorSettings[componentName].colors; } return acc; - }, {}); - const wrappedColorPanelProps = { - title: panelTitle, - initialOpen: false, - colorSettings, - colorPanelProps, - contrastCheckers, - detectedBackgroundColor, - detectedColor, - panelChildren - }; - return { ...components, - ColorPanel: Object(external_wp_element_["createElement"])(color_panel_ColorPanel, wrappedColorPanelProps), - InspectorControlsColorPanel: Object(external_wp_element_["createElement"])(InspectorControlsColorPanel, wrappedColorPanelProps) - }; - }, [attributes, setAttributes, detectedColor, detectedBackgroundColor, ...deps]); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/index.js - - - - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/gradients/index.js - - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/with-font-sizes.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - -const DEFAULT_FONT_SIZES = []; -/** - * Higher-order component, which handles font size logic for class generation, - * font size value retrieval, and font size change handling. - * - * @param {...(Object|string)} fontSizeNames 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 = ((...fontSizeNames) => { - /* - * 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. - */ - const fontSizeAttributeNames = Object(external_lodash_["reduce"])(fontSizeNames, (fontSizeAttributeNamesAccumulator, fontSizeAttributeName) => { - fontSizeAttributeNamesAccumulator[fontSizeAttributeName] = `custom${Object(external_lodash_["upperFirst"])(fontSizeAttributeName)}`; - return fontSizeAttributeNamesAccumulator; - }, {}); - return Object(external_wp_compose_["createHigherOrderComponent"])(Object(external_wp_compose_["compose"])([Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => props => { - const fontSizes = useSetting('typography.fontSizes') || DEFAULT_FONT_SIZES; - return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, props, { - fontSizes: fontSizes - })); - }, 'withFontSizes'), WrappedComponent => { - return class extends external_wp_element_["Component"] { - constructor(props) { - super(props); - this.setters = this.createSetters(); - this.state = {}; - } - - createSetters() { - return Object(external_lodash_["reduce"])(fontSizeAttributeNames, (settersAccumulator, customFontSizeAttributeName, fontSizeAttributeName) => { - const upperFirstFontSizeAttributeName = Object(external_lodash_["upperFirst"])(fontSizeAttributeName); - settersAccumulator[`set${upperFirstFontSizeAttributeName}`] = this.createSetFontSize(fontSizeAttributeName, customFontSizeAttributeName); - return settersAccumulator; - }, {}); - } - - createSetFontSize(fontSizeAttributeName, customFontSizeAttributeName) { - return fontSizeValue => { - const fontSizeObject = Object(external_lodash_["find"])(this.props.fontSizes, { - size: Number(fontSizeValue) - }); - this.props.setAttributes({ - [fontSizeAttributeName]: fontSizeObject && fontSizeObject.slug ? fontSizeObject.slug : undefined, - [customFontSizeAttributeName]: fontSizeObject && fontSizeObject.slug ? undefined : fontSizeValue - }); - }; - } - - static getDerivedStateFromProps({ - attributes, - fontSizes - }, previousState) { - const 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; - } - - const newState = Object(external_lodash_["reduce"])(Object(external_lodash_["pickBy"])(fontSizeAttributeNames, didAttributesChange), (newStateAccumulator, customFontSizeAttributeName, fontSizeAttributeName) => { - const fontSizeAttributeValue = attributes[fontSizeAttributeName]; - const fontSizeObject = getFontSize(fontSizes, fontSizeAttributeValue, attributes[customFontSizeAttributeName]); - newStateAccumulator[fontSizeAttributeName] = { ...fontSizeObject, - class: getFontSizeClass(fontSizeAttributeValue) - }; - return newStateAccumulator; - }, {}); - return { ...previousState, - ...newState - }; - } - - render() { - return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, this.props, { - fontSizes: undefined - }, this.state, this.setters)); - } - - }; - }]), 'withFontSizes'); -}); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/index.js - - - - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/align-left.js -var align_left = __webpack_require__("fPbg"); - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/align-center.js -var align_center = __webpack_require__("plpT"); - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/align-right.js -var align_right = __webpack_require__("ziDm"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/ui.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - -const DEFAULT_ALIGNMENT_CONTROLS = [{ - icon: align_left["a" /* default */], - title: Object(external_wp_i18n_["__"])('Align text left'), - align: 'left' -}, { - icon: align_center["a" /* default */], - title: Object(external_wp_i18n_["__"])('Align text center'), - align: 'center' -}, { - icon: align_right["a" /* default */], - title: Object(external_wp_i18n_["__"])('Align text right'), - align: 'right' -}]; -const alignment_control_ui_POPOVER_PROPS = { - position: 'bottom right', - isAlternate: true -}; - -function AlignmentUI({ - value, - onChange, - alignmentControls = DEFAULT_ALIGNMENT_CONTROLS, - label = Object(external_wp_i18n_["__"])('Align'), - describedBy = Object(external_wp_i18n_["__"])('Change text alignment'), - isCollapsed = true, - isToolbar -}) { - function applyOrUnset(align) { - return () => onChange(value === align ? undefined : align); - } - - const activeAlignment = Object(external_lodash_["find"])(alignmentControls, control => control.align === value); - - function setIcon() { - if (activeAlignment) return activeAlignment.icon; - return Object(external_wp_i18n_["isRTL"])() ? align_right["a" /* default */] : align_left["a" /* default */]; - } - - const UIComponent = isToolbar ? external_wp_components_["ToolbarGroup"] : external_wp_components_["ToolbarDropdownMenu"]; - const extraProps = isToolbar ? { - isCollapsed - } : {}; - return Object(external_wp_element_["createElement"])(UIComponent, Object(esm_extends["a" /* default */])({ - icon: setIcon(), - label: label, - toggleProps: { - describedBy - }, - popoverProps: alignment_control_ui_POPOVER_PROPS, - controls: alignmentControls.map(control => { - const { - align - } = control; - const isActive = value === align; - return { ...control, - isActive, - role: isCollapsed ? 'menuitemradio' : undefined, - onClick: applyOrUnset(align) - }; - }) - }, extraProps)); -} - -/* harmony default export */ var alignment_control_ui = (AlignmentUI); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/index.js - - - -/** - * Internal dependencies - */ - -function AlignmentControl(props) { - return Object(external_wp_element_["createElement"])(alignment_control_ui, Object(esm_extends["a" /* default */])({}, props, { - isToolbar: false - })); -} -function AlignmentToolbar(props) { - return Object(external_wp_element_["createElement"])(alignment_control_ui, Object(esm_extends["a" /* default */])({}, props, { - isToolbar: true - })); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/search-items.js -/** - * External dependencies - */ - // Default search helpers - -const defaultGetName = item => item.name || ''; - -const defaultGetTitle = item => item.title; - -const defaultGetDescription = item => item.description || ''; - -const defaultGetKeywords = item => item.keywords || []; - -const defaultGetCategory = item => item.category; - -const defaultGetCollection = () => null; -/** - * Sanitizes the search input string. - * - * @param {string} input The search input to normalize. - * - * @return {string} The normalized search input. - */ - - -function normalizeSearchInput(input = '') { - // Disregard diacritics. - // Input: "média" - input = Object(external_lodash_["deburr"])(input); // Accommodate leading slash, matching autocomplete expectations. - // Input: "/media" - - input = input.replace(/^\//, ''); // Lowercase. - // Input: "MEDIA" - - input = input.toLowerCase(); - return input; -} -/** - * Converts the search term into a list of normalized terms. - * - * @param {string} input The search term to normalize. - * - * @return {string[]} The normalized list of search terms. - */ - - -const getNormalizedSearchTerms = (input = '') => { - // Extract words. - return Object(external_lodash_["words"])(normalizeSearchInput(input)); -}; - -const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => { - return Object(external_lodash_["differenceWith"])(unmatchedTerms, getNormalizedSearchTerms(unprocessedTerms), (unmatchedTerm, unprocessedTerm) => unprocessedTerm.includes(unmatchedTerm)); -}; - -const searchBlockItems = (items, categories, collections, searchInput) => { - const normalizedSearchTerms = getNormalizedSearchTerms(searchInput); - - if (normalizedSearchTerms.length === 0) { - return items; - } - - const config = { - getCategory: item => { - var _find; - - return (_find = Object(external_lodash_["find"])(categories, { - slug: item.category - })) === null || _find === void 0 ? void 0 : _find.title; - }, - getCollection: item => { - var _collections$item$nam; - - return (_collections$item$nam = collections[item.name.split('/')[0]]) === null || _collections$item$nam === void 0 ? void 0 : _collections$item$nam.title; - } - }; - return searchItems(items, searchInput, config); -}; -/** - * Filters an item list given a search term. - * - * @param {Array} items Item list - * @param {string} searchInput Search input. - * @param {Object} config Search Config. - * @return {Array} Filtered item list. - */ - -const searchItems = (items = [], searchInput = '', config = {}) => { - const normalizedSearchTerms = getNormalizedSearchTerms(searchInput); - - if (normalizedSearchTerms.length === 0) { - return items; - } - - const rankedItems = items.map(item => { - return [item, getItemSearchRank(item, searchInput, config)]; - }).filter(([, rank]) => rank > 0); - rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1); - return rankedItems.map(([item]) => item); -}; -/** - * Get the search rank for a given item and a specific search term. - * The better the match, the higher the rank. - * If the rank equals 0, it should be excluded from the results. - * - * @param {Object} item Item to filter. - * @param {string} searchTerm Search term. - * @param {Object} config Search Config. - * @return {number} Search Rank. - */ - -function getItemSearchRank(item, searchTerm, config = {}) { - const { - getName = defaultGetName, - getTitle = defaultGetTitle, - getDescription = defaultGetDescription, - getKeywords = defaultGetKeywords, - getCategory = defaultGetCategory, - getCollection = defaultGetCollection - } = config; - const name = getName(item); - const title = getTitle(item); - const description = getDescription(item); - const keywords = getKeywords(item); - const category = getCategory(item); - const collection = getCollection(item); - const normalizedSearchInput = normalizeSearchInput(searchTerm); - const normalizedTitle = normalizeSearchInput(title); - let rank = 0; // Prefers exact matches - // Then prefers if the beginning of the title matches the search term - // name, keywords, categories, collection, variations match come later. - - if (normalizedSearchInput === normalizedTitle) { - rank += 30; - } else if (normalizedTitle.startsWith(normalizedSearchInput)) { - rank += 20; - } else { - const terms = [name, title, description, ...keywords, category, collection].join(' '); - const normalizedSearchTerms = Object(external_lodash_["words"])(normalizedSearchInput); - const unmatchedTerms = removeMatchingTerms(normalizedSearchTerms, terms); - - if (unmatchedTerms.length === 0) { - rank += 10; - } - } // Give a better rank to "core" namespaced items. - - - if (rank !== 0 && name.startsWith('core/')) { - rank++; - } - - return rank; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-block-types-state.js -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - -/** - * Retrieves the block types inserter state. - * - * @param {string=} rootClientId Insertion's root client ID. - * @param {Function} onInsert function called when inserter a list of blocks. - * @return {Array} Returns the block types state. (block types, categories, collections, onSelect handler) - */ - -const useBlockTypesState = (rootClientId, onInsert) => { - const { - categories, - collections, - items - } = Object(external_wp_data_["useSelect"])(select => { - const { - getInserterItems - } = select(store); - const { - getCategories, - getCollections - } = select(external_wp_blocks_["store"]); - return { - categories: getCategories(), - collections: getCollections(), - items: getInserterItems(rootClientId) - }; - }, [rootClientId]); - const onSelectItem = Object(external_wp_element_["useCallback"])(({ - name, - initialAttributes, - innerBlocks - }, shouldFocusBlock) => { - const insertedBlock = Object(external_wp_blocks_["createBlock"])(name, initialAttributes, Object(external_wp_blocks_["createBlocksFromInnerBlocksTemplate"])(innerBlocks)); - onInsert(insertedBlock, undefined, shouldFocusBlock); - }, [onInsert]); - return [items, categories, collections, onSelectItem]; -}; - -/* harmony default export */ var use_block_types_state = (useBlockTypesState); - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js -var block_default = __webpack_require__("//Lo"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-icon/index.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - -function BlockIcon({ - icon, - showColors = false, - className -}) { - var _icon; - - if (((_icon = icon) === null || _icon === void 0 ? void 0 : _icon.src) === 'block-default') { - icon = { - src: block_default["a" /* default */] - }; - } - - const renderedIcon = Object(external_wp_element_["createElement"])(external_wp_components_["Icon"], { - icon: icon && icon.src ? icon.src : icon - }); - const style = showColors ? { - backgroundColor: icon && icon.background, - color: icon && icon.foreground - } : {}; - return Object(external_wp_element_["createElement"])("span", { - style: style, - className: classnames_default()('block-editor-block-icon', className, { - 'has-colors': showColors - }) - }, renderedIcon); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/autocompleters/block.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - - -const SHOWN_BLOCK_TYPES = 9; -/** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */ - -/** - * Creates a blocks repeater for replacing the current block with a selected block type. - * - * @return {WPCompleter} A blocks completer. - */ - -function createBlockCompleter() { - return { - name: 'blocks', - className: 'block-editor-autocompleters__block', - triggerPrefix: '/', - - useItems(filterValue) { - const { - rootClientId, - selectedBlockName - } = Object(external_wp_data_["useSelect"])(select => { - const { - getSelectedBlockClientId, - getBlockName, - getBlockInsertionPoint - } = select(store); - const selectedBlockClientId = getSelectedBlockClientId(); - return { - selectedBlockName: selectedBlockClientId ? getBlockName(selectedBlockClientId) : null, - rootClientId: getBlockInsertionPoint().rootClientId - }; - }, []); - const [items, categories, collections] = use_block_types_state(rootClientId, external_lodash_["noop"]); - const filteredItems = Object(external_wp_element_["useMemo"])(() => { - const initialFilteredItems = !!filterValue.trim() ? searchBlockItems(items, categories, collections, filterValue) : Object(external_lodash_["orderBy"])(items, ['frecency'], ['desc']); - return initialFilteredItems.filter(item => item.name !== selectedBlockName).slice(0, SHOWN_BLOCK_TYPES); - }, [filterValue, selectedBlockName, items, categories, collections]); - const options = Object(external_wp_element_["useMemo"])(() => filteredItems.map(blockItem => { - const { - title, - icon, - isDisabled - } = blockItem; - return { - key: `block-${blockItem.id}`, - value: blockItem, - label: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(BlockIcon, { - key: "icon", - icon: icon, - showColors: true - }), title), - isDisabled - }; - }), [filteredItems]); - return [options]; - }, - - allowContext(before, after) { - return !(/\S/.test(before) || /\S/.test(after)); - }, - - getOptionCompletion(inserterItem) { - const { - name, - initialAttributes, - innerBlocks - } = inserterItem; - return { - action: 'replace', - value: Object(external_wp_blocks_["createBlock"])(name, initialAttributes, Object(external_wp_blocks_["createBlocksFromInnerBlocksTemplate"])(innerBlocks)) - }; - } - - }; -} -/** - * Creates a blocks repeater for replacing the current block with a selected block type. - * - * @return {WPCompleter} A blocks completer. - */ - - -/* harmony default export */ var autocompleters_block = (createBlockCompleter()); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/autocomplete/index.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - -/** - * Shared reference to an empty array for cases where it is important to avoid - * returning a new array reference on every invocation. - * - * @type {Array} - */ - -const autocomplete_EMPTY_ARRAY = []; - -function useCompleters({ - completers = autocomplete_EMPTY_ARRAY -}) { - const { - name - } = useBlockEditContext(); - return Object(external_wp_element_["useMemo"])(() => { - let filteredCompleters = completers; - - if (name === Object(external_wp_blocks_["getDefaultBlockName"])()) { - filteredCompleters = filteredCompleters.concat([autocompleters_block]); - } - - if (Object(external_wp_hooks_["hasFilter"])('editor.Autocomplete.completers')) { - // Provide copies so filters may directly modify them. - if (filteredCompleters === completers) { - filteredCompleters = filteredCompleters.map(external_lodash_["clone"]); - } - - filteredCompleters = Object(external_wp_hooks_["applyFilters"])('editor.Autocomplete.completers', filteredCompleters, name); - } - - return filteredCompleters; - }, [completers, name]); -} - -function useBlockEditorAutocompleteProps(props) { - return Object(external_wp_components_["__unstableUseAutocompleteProps"])({ ...props, - completers: useCompleters(props) - }); -} -/** - * Wrap the default Autocomplete component with one that supports a filter hook - * for customizing its list of autocompleters. - * - * @type {import('react').FC} - */ - -function BlockEditorAutocomplete(props) { - return Object(external_wp_element_["createElement"])(external_wp_components_["Autocomplete"], Object(esm_extends["a" /* default */])({}, props, { - completers: useCompleters(props) - })); -} -/** - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/autocomplete/README.md - */ - - -/* harmony default export */ var autocomplete = (BlockEditorAutocomplete); - -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/fullscreen.js - - -/** - * WordPress dependencies - */ - -const fullscreen = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { - d: "M4.2 9h1.5V5.8H9V4.2H4.2V9zm14 9.2H15v1.5h4.8V15h-1.5v3.2zM15 4.2v1.5h3.2V9h1.5V4.2H15zM5.8 15H4.2v4.8H9v-1.5H5.8V15z" -})); -/* harmony default export */ var library_fullscreen = (fullscreen); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-full-height-alignment-control/index.js - - -/** - * WordPress dependencies - */ - - - - -function BlockFullHeightAlignmentControl({ - isActive, - label = Object(external_wp_i18n_["__"])('Toggle full height'), - onToggle, - isDisabled -}) { - return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { - isActive: isActive, - icon: library_fullscreen, - label: label, - onClick: () => onToggle(!isActive), - disabled: isDisabled - }); -} - -/* harmony default export */ var block_full_height_alignment_control = (BlockFullHeightAlignmentControl); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-matrix-control/index.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - -function BlockAlignmentMatrixControl(props) { - const { - label = Object(external_wp_i18n_["__"])('Change matrix alignment'), - onChange = external_lodash_["noop"], - value = 'center', - isDisabled - } = props; - const icon = Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalAlignmentMatrixControl"].Icon, { - value: value - }); - const className = 'block-editor-block-alignment-matrix-control'; - const popoverClassName = `${className}__popover`; - const isAlternate = true; - return Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], { - position: "bottom right", - className: className, - popoverProps: { - className: popoverClassName, - isAlternate - }, - renderToggle: ({ - onToggle, - isOpen - }) => { - const openOnArrowDown = event => { - if (!isOpen && event.keyCode === external_wp_keycodes_["DOWN"]) { - event.preventDefault(); - event.stopPropagation(); - onToggle(); - } - }; - - return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { - onClick: onToggle, - "aria-haspopup": "true", - "aria-expanded": isOpen, - onKeyDown: openOnArrowDown, - label: label, - icon: icon, - showTooltip: true, - disabled: isDisabled - }); - }, - renderContent: () => Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalAlignmentMatrixControl"], { - hasFocusBorder: false, - onChange: onChange, - value: value - }) - }); -} - -/* harmony default export */ var block_alignment_matrix_control = (BlockAlignmentMatrixControl); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-block-display-information/index.js -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -/** @typedef {import('@wordpress/blocks').WPIcon} WPIcon */ - -/** - * Contains basic block's information for display reasons. - * - * @typedef {Object} WPBlockDisplayInformation - * - * @property {string} title Human-readable block type label. - * @property {WPIcon} icon Block type icon. - * @property {string} description A detailed block type description. - */ - -/** - * Hook used to try to find a matching block variation and return - * the appropriate information for display reasons. In order to - * to try to find a match we need to things: - * 1. Block's client id to extract it's current attributes. - * 2. A block variation should have set `isActive` prop to a proper function. - * - * If for any reason a block variaton match cannot be found, - * the returned information come from the Block Type. - * If no blockType is found with the provided clientId, returns null. - * - * @param {string} clientId Block's client id. - * @return {?WPBlockDisplayInformation} Block's display information, or `null` when the block or its type not found. - */ - -function useBlockDisplayInformation(clientId) { - return Object(external_wp_data_["useSelect"])(select => { - if (!clientId) return null; - const { - getBlockName, - getBlockAttributes - } = select(store); - const { - getBlockType, - getActiveBlockVariation - } = select(external_wp_blocks_["store"]); - const blockName = getBlockName(clientId); - const blockType = getBlockType(blockName); - if (!blockType) return null; - const attributes = getBlockAttributes(clientId); - const match = getActiveBlockVariation(blockName, attributes); - const blockTypeInfo = { - title: blockType.title, - icon: blockType.icon, - description: blockType.description, - anchor: attributes === null || attributes === void 0 ? void 0 : attributes.anchor - }; - if (!match) return blockTypeInfo; - return { - title: match.title || blockType.title, - icon: match.icon || blockType.icon, - description: match.description || blockType.description - }; - }, [clientId]); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-title/index.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - -/** - * Renders the block's configured title as a string, or empty if the title - * cannot be determined. - * - * @example - * - * ```jsx - * - * ``` - * - * @param {Object} props - * @param {string} props.clientId Client ID of block. - * - * @return {?string} Block title. - */ - -function BlockTitle({ - clientId -}) { - const { - attributes, - name, - reusableBlockTitle - } = Object(external_wp_data_["useSelect"])(select => { - if (!clientId) { - return {}; - } - - const { - getBlockName, - getBlockAttributes, - __experimentalGetReusableBlockTitle - } = select(store); - const blockName = getBlockName(clientId); - - if (!blockName) { - return {}; - } - - const isReusable = Object(external_wp_blocks_["isReusableBlock"])(Object(external_wp_blocks_["getBlockType"])(blockName)); - return { - attributes: getBlockAttributes(clientId), - name: blockName, - reusableBlockTitle: isReusable && __experimentalGetReusableBlockTitle(getBlockAttributes(clientId).ref) - }; - }, [clientId]); - const blockInformation = useBlockDisplayInformation(clientId); - if (!name || !blockInformation) return null; - const blockType = Object(external_wp_blocks_["getBlockType"])(name); - const label = reusableBlockTitle || Object(external_wp_blocks_["__experimentalGetBlockLabel"])(blockType, attributes); // Label will fallback to the title if no label is defined for the current - // label context. If the label is defined we prioritize it over possible - // possible block variation title match. - - if (label !== blockType.title) { - return Object(external_lodash_["truncate"])(label, { - length: 35 - }); - } - - return blockInformation.title; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-breadcrumb/index.js - - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - -/** - * Block breadcrumb component, displaying the hierarchy of the current block selection as a breadcrumb. - * - * @param {Object} props Component props. - * @param {string} props.rootLabelText Translated label for the root element of the breadcrumb trail. - * @return {WPElement} Block Breadcrumb. - */ - -function BlockBreadcrumb({ - rootLabelText -}) { - const { - selectBlock, - clearSelectedBlock - } = Object(external_wp_data_["useDispatch"])(store); - const { - clientId, - parents, - hasSelection - } = Object(external_wp_data_["useSelect"])(select => { - const { - getSelectionStart, - getSelectedBlockClientId, - getBlockParents - } = select(store); - const selectedBlockClientId = getSelectedBlockClientId(); - return { - parents: getBlockParents(selectedBlockClientId), - clientId: selectedBlockClientId, - hasSelection: !!getSelectionStart().clientId - }; + }, []); + rules.push(...sideRules); + } + + return rules; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/style-engine/build-module/styles/padding.js +/** + * Internal dependencies + */ + +const padding = { + name: 'padding', + generate: (style, options) => { + return generateBoxRules(style, options, ['spacing', 'padding'], 'padding'); + } +}; +/* harmony default export */ var styles_padding = (padding); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/style-engine/build-module/styles/margin.js +/** + * Internal dependencies + */ + +const margin = { + name: 'margin', + generate: (style, options) => { + return generateBoxRules(style, options, ['spacing', 'margin'], 'margin'); + } +}; +/* harmony default export */ var styles_margin = (margin); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/style-engine/build-module/styles/index.js +/** + * Internal dependencies + */ + + +const styleDefinitions = [styles_margin, styles_padding]; + +;// CONCATENATED MODULE: ./node_modules/@wordpress/style-engine/build-module/index.js +/** + * External dependencies + */ + +/** + * Internal dependencies + */ + + +/** + * Generates a stylesheet for a given style object and selector. + * + * @param style Style object. + * @param options Options object with settings to adjust how the styles are generated. + * + * @return generated stylesheet. + */ + +function generate(style, options) { + const rules = getCSSRules(style, options); + const groupedRules = groupBy(rules, 'selector'); + const selectorRules = Object.keys(groupedRules).reduce((acc, subSelector) => { + acc.push(`${subSelector} { ${groupedRules[subSelector].map(rule => `${kebabCase(rule.key)}: ${rule.value};`).join(' ')} }`); + return acc; }, []); - - const rootLabel = rootLabelText || Object(external_wp_i18n_["__"])('Document'); - /* - * Disable reason: The `list` ARIA role is redundant but - * Safari+VoiceOver won't announce the list otherwise. - */ - - /* eslint-disable jsx-a11y/no-redundant-roles */ - - - return Object(external_wp_element_["createElement"])("ul", { - className: "block-editor-block-breadcrumb", - role: "list", - "aria-label": Object(external_wp_i18n_["__"])('Block breadcrumb') - }, Object(external_wp_element_["createElement"])("li", { - className: !hasSelection ? 'block-editor-block-breadcrumb__current' : undefined, - "aria-current": !hasSelection ? 'true' : undefined - }, hasSelection && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - className: "block-editor-block-breadcrumb__button", - isTertiary: true, - onClick: clearSelectedBlock - }, rootLabel), !hasSelection && rootLabel), parents.map(parentClientId => Object(external_wp_element_["createElement"])("li", { - key: parentClientId - }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - className: "block-editor-block-breadcrumb__button", - isTertiary: true, - onClick: () => selectBlock(parentClientId) - }, Object(external_wp_element_["createElement"])(BlockTitle, { - clientId: parentClientId - })))), !!clientId && Object(external_wp_element_["createElement"])("li", { - className: "block-editor-block-breadcrumb__current", - "aria-current": "true" - }, Object(external_wp_element_["createElement"])(BlockTitle, { - clientId: clientId - }))) - /* eslint-enable jsx-a11y/no-redundant-roles */ - ; -} - -/* harmony default export */ var block_breadcrumb = (BlockBreadcrumb); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-context/index.js + return selectorRules.join('\n'); +} +/** + * Returns a JSON representation of the generated CSS rules. + * + * @param style Style object. + * @param options Options object with settings to adjust how the styles are generated. + * + * @return generated styles. + */ + +function getCSSRules(style, options) { + const rules = []; + styleDefinitions.forEach(definition => { + rules.push(...definition.generate(style, options)); + }); + return rules; +} + +;// CONCATENATED MODULE: external ["wp","dom"] +var external_wp_dom_namespaceObject = window["wp"]["dom"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-context/index.js /** @@ -19343,7 +12856,7 @@ /** @type {import('react').Context>} */ -const block_context_Context = Object(external_wp_element_["createContext"])({}); +const block_context_Context = (0,external_wp_element_namespaceObject.createContext)({}); /** * Component which merges passed value with current consumed block context. * @@ -19352,108 +12865,23 @@ * @param {BlockContextProviderProps} props */ -function BlockContextProvider({ - value, - children -}) { - const context = Object(external_wp_element_["useContext"])(block_context_Context); - const nextValue = Object(external_wp_element_["useMemo"])(() => ({ ...context, +function BlockContextProvider(_ref) { + let { + value, + children + } = _ref; + const context = (0,external_wp_element_namespaceObject.useContext)(block_context_Context); + const nextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...context, ...value }), [context, value]); - return Object(external_wp_element_["createElement"])(block_context_Context.Provider, { + return (0,external_wp_element_namespaceObject.createElement)(block_context_Context.Provider, { value: nextValue, children: children }); } /* harmony default export */ var block_context = (block_context_Context); -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-style-selector/index.js - - -/** - * WordPress dependencies - */ - - - - -const ColorSelectorSVGIcon = () => Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { - xmlns: "https://www.w3.org/2000/svg", - viewBox: "0 0 20 20" -}, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { - d: "M7.434 5l3.18 9.16H8.538l-.692-2.184H4.628l-.705 2.184H2L5.18 5h2.254zm-1.13 1.904h-.115l-1.148 3.593H7.44L6.304 6.904zM14.348 7.006c1.853 0 2.9.876 2.9 2.374v4.78h-1.79v-.914h-.114c-.362.64-1.123 1.022-2.031 1.022-1.346 0-2.292-.826-2.292-2.108 0-1.27.972-2.006 2.71-2.107l1.696-.102V9.38c0-.584-.42-.914-1.18-.914-.667 0-1.112.228-1.264.647h-1.701c.12-1.295 1.307-2.107 3.066-2.107zm1.079 4.1l-1.416.09c-.793.056-1.18.342-1.18.844 0 .52.45.837 1.091.837.857 0 1.505-.545 1.505-1.256v-.515z" -})); -/** - * Color Selector Icon component. - * - * @param {Object} props Component properties. - * @param {Object} props.style Style object. - * @param {string} props.className Class name for component. - * - * @return {*} React Icon component. - */ - - -const ColorSelectorIcon = ({ - style, - className -}) => { - return Object(external_wp_element_["createElement"])("div", { - className: "block-library-colors-selector__icon-container" - }, Object(external_wp_element_["createElement"])("div", { - className: `${className} block-library-colors-selector__state-selection`, - style: style - }, Object(external_wp_element_["createElement"])(ColorSelectorSVGIcon, null))); -}; -/** - * Renders the Colors Selector Toolbar with the icon button. - * - * @param {Object} props Component properties. - * @param {Object} props.TextColor Text color component that wraps icon. - * @param {Object} props.BackgroundColor Background color component that wraps icon. - * - * @return {*} React toggle button component. - */ - - -const renderToggleComponent = ({ - TextColor, - BackgroundColor -}) => ({ - onToggle, - isOpen -}) => { - const openOnArrowDown = event => { - if (!isOpen && event.keyCode === external_wp_keycodes_["DOWN"]) { - event.preventDefault(); - event.stopPropagation(); - onToggle(); - } - }; - - return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { - className: "components-toolbar__control block-library-colors-selector__toggle", - label: Object(external_wp_i18n_["__"])('Open Colors Selector'), - onClick: onToggle, - onKeyDown: openOnArrowDown, - icon: Object(external_wp_element_["createElement"])(BackgroundColor, null, Object(external_wp_element_["createElement"])(TextColor, null, Object(external_wp_element_["createElement"])(ColorSelectorIcon, null))) - })); -}; - -const BlockColorsStyleSelector = ({ - children, - ...other -}) => Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], { - position: "bottom right", - className: "block-library-colors-selector", - contentClassName: "block-library-colors-selector__popover", - renderToggle: renderToggleComponent(other), - renderContent: () => children -}); - -/* harmony default export */ var color_style_selector = (BlockColorsStyleSelector); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-edit/edit.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-edit/edit.js @@ -19484,16 +12912,16 @@ */ const DEFAULT_BLOCK_CONTEXT = {}; -const edit_Edit = props => { +const Edit = props => { const { attributes = {}, name } = props; - const blockType = Object(external_wp_blocks_["getBlockType"])(name); - const blockContext = Object(external_wp_element_["useContext"])(block_context); // Assign context values using the block type's declared context needs. - - const context = Object(external_wp_element_["useMemo"])(() => { - return blockType && blockType.usesContext ? Object(external_lodash_["pick"])(blockContext, blockType.usesContext) : DEFAULT_BLOCK_CONTEXT; + const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); + const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context); // Assign context values using the block type's declared context needs. + + const context = (0,external_wp_element_namespaceObject.useMemo)(() => { + return blockType && blockType.usesContext ? (0,external_lodash_namespaceObject.pick)(blockContext, blockType.usesContext) : DEFAULT_BLOCK_CONTEXT; }, [blockType, blockContext]); if (!blockType) { @@ -19505,37 +12933,46 @@ const Component = blockType.edit || blockType.save; - if (blockType.apiVersion > 1 || Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'lightBlockWrapper', false)) { - return Object(external_wp_element_["createElement"])(Component, Object(esm_extends["a" /* default */])({}, props, { + if (blockType.apiVersion > 1) { + return (0,external_wp_element_namespaceObject.createElement)(Component, _extends({}, props, { context: context })); - } // Generate a class name for the block's editable form - - - const generatedClassName = Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'className', true) ? Object(external_wp_blocks_["getBlockDefaultClassName"])(name) : null; + } // Generate a class name for the block's editable form. + + + const generatedClassName = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'className', true) ? (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(name) : null; const className = classnames_default()(generatedClassName, attributes.className); - return Object(external_wp_element_["createElement"])(Component, Object(esm_extends["a" /* default */])({}, props, { + return (0,external_wp_element_namespaceObject.createElement)(Component, _extends({}, props, { context: context, className: className })); }; -/* harmony default export */ var edit = (Object(external_wp_components_["withFilters"])('editor.BlockEdit')(edit_Edit)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-edit/index.js - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - - - -function block_edit_BlockEdit(props) { +/* harmony default export */ var edit = ((0,external_wp_components_namespaceObject.withFilters)('editor.BlockEdit')(Edit)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-edit/index.js + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + +/** + * The `useBlockEditContext` hook provides information about the block this hook is being used in. + * It returns an object with the `name`, `isSelected` state, and the `clientId` of the block. + * It is useful if you want to create custom hooks that need access to the current blocks clientId + * but don't want to rely on the data getting passed in as a parameter. + * + * @return {Object} Block edit context + */ + + +function BlockEdit(props) { const { name, isSelected, @@ -19546,27 +12983,4672 @@ isSelected, clientId }; - return Object(external_wp_element_["createElement"])(context_Provider // It is important to return the same object if props haven't + return (0,external_wp_element_namespaceObject.createElement)(Provider // It is important to return the same object if props haven't // changed to avoid unnecessary rerenders. // See https://reactjs.org/docs/context.html#caveats. , { - value: Object(external_wp_element_["useMemo"])(() => context, Object.values(context)) - }, Object(external_wp_element_["createElement"])(edit, props)); -} - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js -var list_view = __webpack_require__("OzlF"); - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js -var more_vertical = __webpack_require__("VKE3"); - -// EXTERNAL MODULE: ./node_modules/react-spring/web.cjs.js -var web_cjs = __webpack_require__("ZO3Q"); - -// EXTERNAL MODULE: external ["wp","dom"] -var external_wp_dom_ = __webpack_require__("1CF3"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-moving-animation/index.js + value: (0,external_wp_element_namespaceObject.useMemo)(() => context, Object.values(context)) + }, (0,external_wp_element_namespaceObject.createElement)(edit, props)); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-horizontal.js + + +/** + * WordPress dependencies + */ + +const moreHorizontal = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M11 13h2v-2h-2v2zm-6 0h2v-2H5v2zm12-2v2h2v-2h-2z" +})); +/* harmony default export */ var more_horizontal = (moreHorizontal); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/warning/index.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +function Warning(_ref) { + let { + className, + actions, + children, + secondaryActions + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)("div", { + style: { + display: 'contents', + all: 'initial' + } + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: classnames_default()(className, 'block-editor-warning') + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-warning__contents" + }, (0,external_wp_element_namespaceObject.createElement)("p", { + className: "block-editor-warning__message" + }, children), (external_wp_element_namespaceObject.Children.count(actions) > 0 || secondaryActions) && (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-warning__actions" + }, external_wp_element_namespaceObject.Children.count(actions) > 0 && external_wp_element_namespaceObject.Children.map(actions, (action, i) => (0,external_wp_element_namespaceObject.createElement)("span", { + key: i, + className: "block-editor-warning__action" + }, action)), secondaryActions && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, { + className: "block-editor-warning__secondary", + icon: more_horizontal, + label: (0,external_wp_i18n_namespaceObject.__)('More options'), + popoverProps: { + position: 'bottom left', + className: 'block-editor-warning__dropdown' + }, + noIcons: true + }, () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, secondaryActions.map((item, pos) => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + onClick: item.onClick, + key: pos + }, item.title)))))))); +} +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/warning/README.md + */ + + +/* harmony default export */ var warning = (Warning); + +// EXTERNAL MODULE: ./node_modules/diff/lib/diff/character.js +var character = __webpack_require__(1973); +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-compare/block-view.js + + +/** + * WordPress dependencies + */ + + + +function BlockView(_ref) { + let { + title, + rawContent, + renderedContent, + action, + actionText, + className + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: className + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-compare__content" + }, (0,external_wp_element_namespaceObject.createElement)("h2", { + className: "block-editor-block-compare__heading" + }, title), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-compare__html" + }, rawContent), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-compare__preview edit-post-visual-editor" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, (0,external_wp_dom_namespaceObject.safeHTML)(renderedContent)))), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-compare__action" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + variant: "secondary", + tabIndex: "0", + onClick: action + }, actionText))); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-compare/index.js + + +/** + * External dependencies + */ + + // diff doesn't tree-shake correctly, so we import from the individual +// module here, to avoid including too much of the library + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + +function BlockCompare(_ref) { + let { + block, + onKeep, + onConvert, + convertor, + convertButtonText + } = _ref; + + function getDifference(originalContent, newContent) { + const difference = (0,character/* diffChars */.Kx)(originalContent, newContent); + return difference.map((item, pos) => { + const classes = classnames_default()({ + 'block-editor-block-compare__added': item.added, + 'block-editor-block-compare__removed': item.removed + }); + return (0,external_wp_element_namespaceObject.createElement)("span", { + key: pos, + className: classes + }, item.value); + }); + } + + function getConvertedContent(convertedBlock) { + // The convertor may return an array of items or a single item. + const newBlocks = (0,external_lodash_namespaceObject.castArray)(convertedBlock); // Get converted block details. + + const newContent = newBlocks.map(item => (0,external_wp_blocks_namespaceObject.getSaveContent)(item.name, item.attributes, item.innerBlocks)); + return newContent.join(''); + } + + const converted = getConvertedContent(convertor(block)); + const difference = getDifference(block.originalContent, converted); + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-compare__wrapper" + }, (0,external_wp_element_namespaceObject.createElement)(BlockView, { + title: (0,external_wp_i18n_namespaceObject.__)('Current'), + className: "block-editor-block-compare__current", + action: onKeep, + actionText: (0,external_wp_i18n_namespaceObject.__)('Convert to HTML'), + rawContent: block.originalContent, + renderedContent: block.originalContent + }), (0,external_wp_element_namespaceObject.createElement)(BlockView, { + title: (0,external_wp_i18n_namespaceObject.__)('After Conversion'), + className: "block-editor-block-compare__converted", + action: onConvert, + actionText: convertButtonText, + rawContent: difference, + renderedContent: converted + })); +} + +/* harmony default export */ var block_compare = (BlockCompare); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-invalid-warning.js + + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + + +function BlockInvalidWarning(_ref) { + let { + convertToHTML, + convertToBlocks, + convertToClassic, + attemptBlockRecovery, + block + } = _ref; + const hasHTMLBlock = !!(0,external_wp_blocks_namespaceObject.getBlockType)('core/html'); + const [compare, setCompare] = (0,external_wp_element_namespaceObject.useState)(false); + const onCompare = (0,external_wp_element_namespaceObject.useCallback)(() => setCompare(true), []); + const onCompareClose = (0,external_wp_element_namespaceObject.useCallback)(() => setCompare(false), []); // We memo the array here to prevent the children components from being updated unexpectedly. + + const hiddenActions = (0,external_wp_element_namespaceObject.useMemo)(() => [{ + // translators: Button to fix block content + title: (0,external_wp_i18n_namespaceObject._x)('Resolve', 'imperative verb'), + onClick: onCompare + }, hasHTMLBlock && { + title: (0,external_wp_i18n_namespaceObject.__)('Convert to HTML'), + onClick: convertToHTML + }, { + title: (0,external_wp_i18n_namespaceObject.__)('Convert to Classic Block'), + onClick: convertToClassic + }].filter(Boolean), [onCompare, convertToHTML, convertToClassic]); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(warning, { + actions: [(0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + key: "recover", + onClick: attemptBlockRecovery, + variant: "primary" + }, (0,external_wp_i18n_namespaceObject.__)('Attempt Block Recovery'))], + secondaryActions: hiddenActions + }, (0,external_wp_i18n_namespaceObject.__)('This block contains unexpected or invalid content.')), compare && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { + title: // translators: Dialog title to fix block content + (0,external_wp_i18n_namespaceObject.__)('Resolve Block'), + onRequestClose: onCompareClose, + className: "block-editor-block-compare" + }, (0,external_wp_element_namespaceObject.createElement)(block_compare, { + block: block, + onKeep: convertToHTML, + onConvert: convertToBlocks, + convertor: blockToBlocks, + convertButtonText: (0,external_wp_i18n_namespaceObject.__)('Convert to Blocks') + }))); +} + +const blockToClassic = block => (0,external_wp_blocks_namespaceObject.createBlock)('core/freeform', { + content: block.originalContent +}); + +const blockToHTML = block => (0,external_wp_blocks_namespaceObject.createBlock)('core/html', { + content: block.originalContent +}); + +const blockToBlocks = block => (0,external_wp_blocks_namespaceObject.rawHandler)({ + HTML: block.originalContent +}); + +const recoverBlock = _ref2 => { + let { + name, + attributes, + innerBlocks + } = _ref2; + return (0,external_wp_blocks_namespaceObject.createBlock)(name, attributes, innerBlocks); +}; + +/* harmony default export */ var block_invalid_warning = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, _ref3) => { + let { + clientId + } = _ref3; + return { + block: select(store).getBlock(clientId) + }; +}), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref4) => { + let { + block + } = _ref4; + const { + replaceBlock + } = dispatch(store); + return { + convertToClassic() { + replaceBlock(block.clientId, blockToClassic(block)); + }, + + convertToHTML() { + replaceBlock(block.clientId, blockToHTML(block)); + }, + + convertToBlocks() { + replaceBlock(block.clientId, blockToBlocks(block)); + }, + + attemptBlockRecovery() { + replaceBlock(block.clientId, recoverBlock(block)); + } + + }; +})])(BlockInvalidWarning)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-crash-warning.js + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + +const block_crash_warning_warning = (0,external_wp_element_namespaceObject.createElement)(warning, { + className: "block-editor-block-list__block-crash-warning" +}, (0,external_wp_i18n_namespaceObject.__)('This block has encountered an error and cannot be previewed.')); +/* harmony default export */ var block_crash_warning = (() => block_crash_warning_warning); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-crash-boundary.js +/** + * WordPress dependencies + */ + + +class BlockCrashBoundary extends external_wp_element_namespaceObject.Component { + constructor() { + super(...arguments); + this.state = { + hasError: false + }; + } + + componentDidCatch() { + this.setState({ + hasError: true + }); + } + + render() { + if (this.state.hasError) { + return this.props.fallback; + } + + return this.props.children; + } + +} + +/* harmony default export */ var block_crash_boundary = (BlockCrashBoundary); + +// EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js +var lib = __webpack_require__(773); +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-html.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + +function BlockHTML(_ref) { + let { + clientId + } = _ref; + const [html, setHtml] = (0,external_wp_element_namespaceObject.useState)(''); + const block = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getBlock(clientId), [clientId]); + const { + updateBlock + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + + const onChange = () => { + const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name); + + if (!blockType) { + return; + } + + const attributes = (0,external_wp_blocks_namespaceObject.getBlockAttributes)(blockType, html, block.attributes); // If html is empty we reset the block to the default HTML and mark it as valid to avoid triggering an error + + const content = html ? html : (0,external_wp_blocks_namespaceObject.getSaveContent)(blockType, attributes); + const [isValid] = html ? (0,external_wp_blocks_namespaceObject.validateBlock)({ ...block, + attributes, + originalContent: content + }) : [true]; + updateBlock(clientId, { + attributes, + originalContent: content, + isValid + }); // Ensure the state is updated if we reset so it displays the default content. + + if (!html) { + setHtml({ + content + }); + } + }; + + (0,external_wp_element_namespaceObject.useEffect)(() => { + setHtml((0,external_wp_blocks_namespaceObject.getBlockContent)(block)); + }, [block]); + return (0,external_wp_element_namespaceObject.createElement)(lib/* default */.Z, { + className: "block-editor-block-list__block-html-textarea", + value: html, + onBlur: onChange, + onChange: event => setHtml(event.target.value) + }); +} + +/* harmony default export */ var block_html = (BlockHTML); + +;// CONCATENATED MODULE: ./node_modules/@react-spring/rafz/dist/react-spring-rafz.esm.js +let updateQueue = makeQueue(); +const raf = fn => schedule(fn, updateQueue); +let writeQueue = makeQueue(); + +raf.write = fn => schedule(fn, writeQueue); + +let onStartQueue = makeQueue(); + +raf.onStart = fn => schedule(fn, onStartQueue); + +let onFrameQueue = makeQueue(); + +raf.onFrame = fn => schedule(fn, onFrameQueue); + +let onFinishQueue = makeQueue(); + +raf.onFinish = fn => schedule(fn, onFinishQueue); + +let timeouts = []; + +raf.setTimeout = (handler, ms) => { + let time = raf.now() + ms; + + let cancel = () => { + let i = timeouts.findIndex(t => t.cancel == cancel); + if (~i) timeouts.splice(i, 1); + pendingCount -= ~i ? 1 : 0; + }; + + let timeout = { + time, + handler, + cancel + }; + timeouts.splice(findTimeout(time), 0, timeout); + pendingCount += 1; + start(); + return timeout; +}; + +let findTimeout = time => ~(~timeouts.findIndex(t => t.time > time) || ~timeouts.length); + +raf.cancel = fn => { + onStartQueue.delete(fn); + onFrameQueue.delete(fn); + onFinishQueue.delete(fn); + updateQueue.delete(fn); + writeQueue.delete(fn); +}; + +raf.sync = fn => { + sync = true; + raf.batchedUpdates(fn); + sync = false; +}; + +raf.throttle = fn => { + let lastArgs; + + function queuedFn() { + try { + fn(...lastArgs); + } finally { + lastArgs = null; + } + } + + function throttled(...args) { + lastArgs = args; + raf.onStart(queuedFn); + } + + throttled.handler = fn; + + throttled.cancel = () => { + onStartQueue.delete(queuedFn); + lastArgs = null; + }; + + return throttled; +}; + +let nativeRaf = typeof window != 'undefined' ? window.requestAnimationFrame : () => {}; + +raf.use = impl => nativeRaf = impl; + +raf.now = typeof performance != 'undefined' ? () => performance.now() : Date.now; + +raf.batchedUpdates = fn => fn(); + +raf.catch = console.error; +raf.frameLoop = 'always'; + +raf.advance = () => { + if (raf.frameLoop !== 'demand') { + console.warn('Cannot call the manual advancement of rafz whilst frameLoop is not set as demand'); + } else { + update(); + } +}; + +let ts = -1; +let pendingCount = 0; +let sync = false; + +function schedule(fn, queue) { + if (sync) { + queue.delete(fn); + fn(0); + } else { + queue.add(fn); + start(); + } +} + +function start() { + if (ts < 0) { + ts = 0; + + if (raf.frameLoop !== 'demand') { + nativeRaf(loop); + } + } +} + +function stop() { + ts = -1; +} + +function loop() { + if (~ts) { + nativeRaf(loop); + raf.batchedUpdates(update); + } +} + +function update() { + let prevTs = ts; + ts = raf.now(); + let count = findTimeout(ts); + + if (count) { + eachSafely(timeouts.splice(0, count), t => t.handler()); + pendingCount -= count; + } + + if (!pendingCount) { + stop(); + return; + } + + onStartQueue.flush(); + updateQueue.flush(prevTs ? Math.min(64, ts - prevTs) : 16.667); + onFrameQueue.flush(); + writeQueue.flush(); + onFinishQueue.flush(); +} + +function makeQueue() { + let next = new Set(); + let current = next; + return { + add(fn) { + pendingCount += current == next && !next.has(fn) ? 1 : 0; + next.add(fn); + }, + + delete(fn) { + pendingCount -= current == next && next.has(fn) ? 1 : 0; + return next.delete(fn); + }, + + flush(arg) { + if (current.size) { + next = new Set(); + pendingCount -= current.size; + eachSafely(current, fn => fn(arg) && next.add(fn)); + pendingCount += next.size; + current = next; + } + } + + }; +} + +function eachSafely(values, each) { + values.forEach(value => { + try { + each(value); + } catch (e) { + raf.catch(e); + } + }); +} + +const __raf = { + count() { + return pendingCount; + }, + + isRunning() { + return ts >= 0; + }, + + clear() { + ts = -1; + timeouts = []; + onStartQueue = makeQueue(); + updateQueue = makeQueue(); + onFrameQueue = makeQueue(); + writeQueue = makeQueue(); + onFinishQueue = makeQueue(); + pendingCount = 0; + } + +}; + + + +// EXTERNAL MODULE: external "React" +var external_React_ = __webpack_require__(9196); +var external_React_default = /*#__PURE__*/__webpack_require__.n(external_React_); +;// CONCATENATED MODULE: ./node_modules/@react-spring/shared/dist/react-spring-shared.esm.js + + + + +function noop() {} +const defineHidden = (obj, key, value) => Object.defineProperty(obj, key, { + value, + writable: true, + configurable: true +}); +const react_spring_shared_esm_is = { + arr: Array.isArray, + obj: a => !!a && a.constructor.name === 'Object', + fun: a => typeof a === 'function', + str: a => typeof a === 'string', + num: a => typeof a === 'number', + und: a => a === undefined +}; +function isEqual(a, b) { + if (react_spring_shared_esm_is.arr(a)) { + if (!react_spring_shared_esm_is.arr(b) || a.length !== b.length) return false; + + for (let i = 0; i < a.length; i++) { + if (a[i] !== b[i]) return false; + } + + return true; + } + + return a === b; +} +const react_spring_shared_esm_each = (obj, fn) => obj.forEach(fn); +function eachProp(obj, fn, ctx) { + if (react_spring_shared_esm_is.arr(obj)) { + for (let i = 0; i < obj.length; i++) { + fn.call(ctx, obj[i], `${i}`); + } + + return; + } + + for (const key in obj) { + if (obj.hasOwnProperty(key)) { + fn.call(ctx, obj[key], key); + } + } +} +const react_spring_shared_esm_toArray = a => react_spring_shared_esm_is.und(a) ? [] : react_spring_shared_esm_is.arr(a) ? a : [a]; +function flush(queue, iterator) { + if (queue.size) { + const items = Array.from(queue); + queue.clear(); + react_spring_shared_esm_each(items, iterator); + } +} +const flushCalls = (queue, ...args) => flush(queue, fn => fn(...args)); +const isSSR = () => typeof window === 'undefined' || !window.navigator || /ServerSideRendering|^Deno\//.test(window.navigator.userAgent); + +let createStringInterpolator$1; +let to; +let colors$1 = null; +let skipAnimation = false; +let willAdvance = noop; +const react_spring_shared_esm_assign = globals => { + if (globals.to) to = globals.to; + if (globals.now) raf.now = globals.now; + if (globals.colors !== undefined) colors$1 = globals.colors; + if (globals.skipAnimation != null) skipAnimation = globals.skipAnimation; + if (globals.createStringInterpolator) createStringInterpolator$1 = globals.createStringInterpolator; + if (globals.requestAnimationFrame) raf.use(globals.requestAnimationFrame); + if (globals.batchedUpdates) raf.batchedUpdates = globals.batchedUpdates; + if (globals.willAdvance) willAdvance = globals.willAdvance; + if (globals.frameLoop) raf.frameLoop = globals.frameLoop; +}; + +var globals = /*#__PURE__*/Object.freeze({ + __proto__: null, + get createStringInterpolator () { return createStringInterpolator$1; }, + get to () { return to; }, + get colors () { return colors$1; }, + get skipAnimation () { return skipAnimation; }, + get willAdvance () { return willAdvance; }, + assign: react_spring_shared_esm_assign +}); + +const startQueue = new Set(); +let currentFrame = []; +let prevFrame = []; +let priority = 0; +const frameLoop = { + get idle() { + return !startQueue.size && !currentFrame.length; + }, + + start(animation) { + if (priority > animation.priority) { + startQueue.add(animation); + raf.onStart(flushStartQueue); + } else { + startSafely(animation); + raf(advance); + } + }, + + advance, + + sort(animation) { + if (priority) { + raf.onFrame(() => frameLoop.sort(animation)); + } else { + const prevIndex = currentFrame.indexOf(animation); + + if (~prevIndex) { + currentFrame.splice(prevIndex, 1); + startUnsafely(animation); + } + } + }, + + clear() { + currentFrame = []; + startQueue.clear(); + } + +}; + +function flushStartQueue() { + startQueue.forEach(startSafely); + startQueue.clear(); + raf(advance); +} + +function startSafely(animation) { + if (!currentFrame.includes(animation)) startUnsafely(animation); +} + +function startUnsafely(animation) { + currentFrame.splice(findIndex(currentFrame, other => other.priority > animation.priority), 0, animation); +} + +function advance(dt) { + const nextFrame = prevFrame; + + for (let i = 0; i < currentFrame.length; i++) { + const animation = currentFrame[i]; + priority = animation.priority; + + if (!animation.idle) { + willAdvance(animation); + animation.advance(dt); + + if (!animation.idle) { + nextFrame.push(animation); + } + } + } + + priority = 0; + prevFrame = currentFrame; + prevFrame.length = 0; + currentFrame = nextFrame; + return currentFrame.length > 0; +} + +function findIndex(arr, test) { + const index = arr.findIndex(test); + return index < 0 ? arr.length : index; +} + +const colors = { + transparent: 0x00000000, + aliceblue: 0xf0f8ffff, + antiquewhite: 0xfaebd7ff, + aqua: 0x00ffffff, + aquamarine: 0x7fffd4ff, + azure: 0xf0ffffff, + beige: 0xf5f5dcff, + bisque: 0xffe4c4ff, + black: 0x000000ff, + blanchedalmond: 0xffebcdff, + blue: 0x0000ffff, + blueviolet: 0x8a2be2ff, + brown: 0xa52a2aff, + burlywood: 0xdeb887ff, + burntsienna: 0xea7e5dff, + cadetblue: 0x5f9ea0ff, + chartreuse: 0x7fff00ff, + chocolate: 0xd2691eff, + coral: 0xff7f50ff, + cornflowerblue: 0x6495edff, + cornsilk: 0xfff8dcff, + crimson: 0xdc143cff, + cyan: 0x00ffffff, + darkblue: 0x00008bff, + darkcyan: 0x008b8bff, + darkgoldenrod: 0xb8860bff, + darkgray: 0xa9a9a9ff, + darkgreen: 0x006400ff, + darkgrey: 0xa9a9a9ff, + darkkhaki: 0xbdb76bff, + darkmagenta: 0x8b008bff, + darkolivegreen: 0x556b2fff, + darkorange: 0xff8c00ff, + darkorchid: 0x9932ccff, + darkred: 0x8b0000ff, + darksalmon: 0xe9967aff, + darkseagreen: 0x8fbc8fff, + darkslateblue: 0x483d8bff, + darkslategray: 0x2f4f4fff, + darkslategrey: 0x2f4f4fff, + darkturquoise: 0x00ced1ff, + darkviolet: 0x9400d3ff, + deeppink: 0xff1493ff, + deepskyblue: 0x00bfffff, + dimgray: 0x696969ff, + dimgrey: 0x696969ff, + dodgerblue: 0x1e90ffff, + firebrick: 0xb22222ff, + floralwhite: 0xfffaf0ff, + forestgreen: 0x228b22ff, + fuchsia: 0xff00ffff, + gainsboro: 0xdcdcdcff, + ghostwhite: 0xf8f8ffff, + gold: 0xffd700ff, + goldenrod: 0xdaa520ff, + gray: 0x808080ff, + green: 0x008000ff, + greenyellow: 0xadff2fff, + grey: 0x808080ff, + honeydew: 0xf0fff0ff, + hotpink: 0xff69b4ff, + indianred: 0xcd5c5cff, + indigo: 0x4b0082ff, + ivory: 0xfffff0ff, + khaki: 0xf0e68cff, + lavender: 0xe6e6faff, + lavenderblush: 0xfff0f5ff, + lawngreen: 0x7cfc00ff, + lemonchiffon: 0xfffacdff, + lightblue: 0xadd8e6ff, + lightcoral: 0xf08080ff, + lightcyan: 0xe0ffffff, + lightgoldenrodyellow: 0xfafad2ff, + lightgray: 0xd3d3d3ff, + lightgreen: 0x90ee90ff, + lightgrey: 0xd3d3d3ff, + lightpink: 0xffb6c1ff, + lightsalmon: 0xffa07aff, + lightseagreen: 0x20b2aaff, + lightskyblue: 0x87cefaff, + lightslategray: 0x778899ff, + lightslategrey: 0x778899ff, + lightsteelblue: 0xb0c4deff, + lightyellow: 0xffffe0ff, + lime: 0x00ff00ff, + limegreen: 0x32cd32ff, + linen: 0xfaf0e6ff, + magenta: 0xff00ffff, + maroon: 0x800000ff, + mediumaquamarine: 0x66cdaaff, + mediumblue: 0x0000cdff, + mediumorchid: 0xba55d3ff, + mediumpurple: 0x9370dbff, + mediumseagreen: 0x3cb371ff, + mediumslateblue: 0x7b68eeff, + mediumspringgreen: 0x00fa9aff, + mediumturquoise: 0x48d1ccff, + mediumvioletred: 0xc71585ff, + midnightblue: 0x191970ff, + mintcream: 0xf5fffaff, + mistyrose: 0xffe4e1ff, + moccasin: 0xffe4b5ff, + navajowhite: 0xffdeadff, + navy: 0x000080ff, + oldlace: 0xfdf5e6ff, + olive: 0x808000ff, + olivedrab: 0x6b8e23ff, + orange: 0xffa500ff, + orangered: 0xff4500ff, + orchid: 0xda70d6ff, + palegoldenrod: 0xeee8aaff, + palegreen: 0x98fb98ff, + paleturquoise: 0xafeeeeff, + palevioletred: 0xdb7093ff, + papayawhip: 0xffefd5ff, + peachpuff: 0xffdab9ff, + peru: 0xcd853fff, + pink: 0xffc0cbff, + plum: 0xdda0ddff, + powderblue: 0xb0e0e6ff, + purple: 0x800080ff, + rebeccapurple: 0x663399ff, + red: 0xff0000ff, + rosybrown: 0xbc8f8fff, + royalblue: 0x4169e1ff, + saddlebrown: 0x8b4513ff, + salmon: 0xfa8072ff, + sandybrown: 0xf4a460ff, + seagreen: 0x2e8b57ff, + seashell: 0xfff5eeff, + sienna: 0xa0522dff, + silver: 0xc0c0c0ff, + skyblue: 0x87ceebff, + slateblue: 0x6a5acdff, + slategray: 0x708090ff, + slategrey: 0x708090ff, + snow: 0xfffafaff, + springgreen: 0x00ff7fff, + steelblue: 0x4682b4ff, + tan: 0xd2b48cff, + teal: 0x008080ff, + thistle: 0xd8bfd8ff, + tomato: 0xff6347ff, + turquoise: 0x40e0d0ff, + violet: 0xee82eeff, + wheat: 0xf5deb3ff, + white: 0xffffffff, + whitesmoke: 0xf5f5f5ff, + yellow: 0xffff00ff, + yellowgreen: 0x9acd32ff +}; + +const NUMBER = '[-+]?\\d*\\.?\\d+'; +const PERCENTAGE = NUMBER + '%'; + +function call(...parts) { + return '\\(\\s*(' + parts.join(')\\s*,\\s*(') + ')\\s*\\)'; +} + +const rgb = new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER)); +const rgba = new RegExp('rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER)); +const hsl = new RegExp('hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE)); +const hsla = new RegExp('hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER)); +const hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/; +const hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/; +const hex6 = /^#([0-9a-fA-F]{6})$/; +const hex8 = /^#([0-9a-fA-F]{8})$/; + +function normalizeColor(color) { + let match; + + if (typeof color === 'number') { + return color >>> 0 === color && color >= 0 && color <= 0xffffffff ? color : null; + } + + if (match = hex6.exec(color)) return parseInt(match[1] + 'ff', 16) >>> 0; + + if (colors$1 && colors$1[color] !== undefined) { + return colors$1[color]; + } + + if (match = rgb.exec(color)) { + return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | 0x000000ff) >>> 0; + } + + if (match = rgba.exec(color)) { + return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | parse1(match[4])) >>> 0; + } + + if (match = hex3.exec(color)) { + return parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + 'ff', 16) >>> 0; + } + + if (match = hex8.exec(color)) return parseInt(match[1], 16) >>> 0; + + if (match = hex4.exec(color)) { + return parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + match[4] + match[4], 16) >>> 0; + } + + if (match = hsl.exec(color)) { + return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | 0x000000ff) >>> 0; + } + + if (match = hsla.exec(color)) { + return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | parse1(match[4])) >>> 0; + } + + return null; +} + +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; +} + +function hslToRgb(h, s, l) { + const q = l < 0.5 ? l * (1 + s) : l + s - l * s; + const p = 2 * l - q; + const r = hue2rgb(p, q, h + 1 / 3); + const g = hue2rgb(p, q, h); + const b = hue2rgb(p, q, h - 1 / 3); + return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8; +} + +function parse255(str) { + const int = parseInt(str, 10); + if (int < 0) return 0; + if (int > 255) return 255; + return int; +} + +function parse360(str) { + const int = parseFloat(str); + return (int % 360 + 360) % 360 / 360; +} + +function parse1(str) { + const num = parseFloat(str); + if (num < 0) return 0; + if (num > 1) return 255; + return Math.round(num * 255); +} + +function parsePercentage(str) { + const int = parseFloat(str); + if (int < 0) return 0; + if (int > 100) return 1; + return int / 100; +} + +function colorToRgba(input) { + let int32Color = normalizeColor(input); + if (int32Color === null) return input; + int32Color = int32Color || 0; + let r = (int32Color & 0xff000000) >>> 24; + let g = (int32Color & 0x00ff0000) >>> 16; + let b = (int32Color & 0x0000ff00) >>> 8; + let a = (int32Color & 0x000000ff) / 255; + return `rgba(${r}, ${g}, ${b}, ${a})`; +} + +const createInterpolator = (range, output, extrapolate) => { + if (react_spring_shared_esm_is.fun(range)) { + return range; + } + + if (react_spring_shared_esm_is.arr(range)) { + return createInterpolator({ + range, + output: output, + extrapolate + }); + } + + if (react_spring_shared_esm_is.str(range.output[0])) { + return createStringInterpolator$1(range); + } + + const config = range; + const outputRange = config.output; + const inputRange = config.range || [0, 1]; + const extrapolateLeft = config.extrapolateLeft || config.extrapolate || 'extend'; + const extrapolateRight = config.extrapolateRight || config.extrapolate || 'extend'; + + const easing = config.easing || (t => t); + + return input => { + const range = findRange(input, inputRange); + return interpolate(input, inputRange[range], inputRange[range + 1], outputRange[range], outputRange[range + 1], easing, extrapolateLeft, extrapolateRight, config.map); + }; +}; + +function interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) { + let result = map ? map(input) : input; + + if (result < inputMin) { + if (extrapolateLeft === 'identity') return result;else if (extrapolateLeft === 'clamp') result = inputMin; + } + + if (result > inputMax) { + if (extrapolateRight === 'identity') return result;else if (extrapolateRight === 'clamp') result = inputMax; + } + + if (outputMin === outputMax) return outputMin; + if (inputMin === inputMax) return input <= inputMin ? outputMin : outputMax; + if (inputMin === -Infinity) result = -result;else if (inputMax === Infinity) result = result - inputMin;else result = (result - inputMin) / (inputMax - inputMin); + result = easing(result); + if (outputMin === -Infinity) result = -result;else if (outputMax === Infinity) result = result + outputMin;else result = result * (outputMax - outputMin) + outputMin; + return result; +} + +function findRange(input, inputRange) { + for (var i = 1; i < inputRange.length - 1; ++i) if (inputRange[i] >= input) break; + + return i - 1; +} + +function react_spring_shared_esm_extends() { + react_spring_shared_esm_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 react_spring_shared_esm_extends.apply(this, arguments); +} + +const $get = Symbol.for('FluidValue.get'); +const $observers = Symbol.for('FluidValue.observers'); + +const hasFluidValue = arg => Boolean(arg && arg[$get]); + +const getFluidValue = arg => arg && arg[$get] ? arg[$get]() : arg; + +const getFluidObservers = target => target[$observers] || null; + +function callFluidObserver(observer, event) { + if (observer.eventObserved) { + observer.eventObserved(event); + } else { + observer(event); + } +} + +function callFluidObservers(target, event) { + let observers = target[$observers]; + + if (observers) { + observers.forEach(observer => { + callFluidObserver(observer, event); + }); + } +} + +class FluidValue { + constructor(get) { + this[$get] = void 0; + this[$observers] = void 0; + + if (!get && !(get = this.get)) { + throw Error('Unknown getter'); + } + + setFluidGetter(this, get); + } + +} + +const setFluidGetter = (target, get) => setHidden(target, $get, get); + +function addFluidObserver(target, observer) { + if (target[$get]) { + let observers = target[$observers]; + + if (!observers) { + setHidden(target, $observers, observers = new Set()); + } + + if (!observers.has(observer)) { + observers.add(observer); + + if (target.observerAdded) { + target.observerAdded(observers.size, observer); + } + } + } + + return observer; +} + +function removeFluidObserver(target, observer) { + let observers = target[$observers]; + + if (observers && observers.has(observer)) { + const count = observers.size - 1; + + if (count) { + observers.delete(observer); + } else { + target[$observers] = null; + } + + if (target.observerRemoved) { + target.observerRemoved(count, observer); + } + } +} + +const setHidden = (target, key, value) => Object.defineProperty(target, key, { + value, + writable: true, + configurable: true +}); + +const numberRegex = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g; +const colorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi; +const unitRegex = new RegExp(`(${numberRegex.source})(%|[a-z]+)`, 'i'); +const rgbaRegex = /rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi; +const cssVariableRegex = /var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/; + +const variableToRgba = input => { + const [token, fallback] = parseCSSVariable(input); + + if (!token || isSSR()) { + return input; + } + + const value = window.getComputedStyle(document.documentElement).getPropertyValue(token); + + if (value) { + return value.trim(); + } else if (fallback && fallback.startsWith('--')) { + const _value = window.getComputedStyle(document.documentElement).getPropertyValue(fallback); + + if (_value) { + return _value; + } else { + return input; + } + } else if (fallback && cssVariableRegex.test(fallback)) { + return variableToRgba(fallback); + } else if (fallback) { + return fallback; + } + + return input; +}; + +const parseCSSVariable = current => { + const match = cssVariableRegex.exec(current); + if (!match) return [,]; + const [, token, fallback] = match; + return [token, fallback]; +}; + +let namedColorRegex; + +const rgbaRound = (_, p1, p2, p3, p4) => `rgba(${Math.round(p1)}, ${Math.round(p2)}, ${Math.round(p3)}, ${p4})`; + +const createStringInterpolator = config => { + if (!namedColorRegex) namedColorRegex = colors$1 ? new RegExp(`(${Object.keys(colors$1).join('|')})(?!\\w)`, 'g') : /^\b$/; + const output = config.output.map(value => { + return getFluidValue(value).replace(cssVariableRegex, variableToRgba).replace(colorRegex, colorToRgba).replace(namedColorRegex, colorToRgba); + }); + const keyframes = output.map(value => value.match(numberRegex).map(Number)); + const outputRanges = keyframes[0].map((_, i) => keyframes.map(values => { + if (!(i in values)) { + throw Error('The arity of each "output" value must be equal'); + } + + return values[i]; + })); + const interpolators = outputRanges.map(output => createInterpolator(react_spring_shared_esm_extends({}, config, { + output + }))); + return input => { + var _output$find; + + const missingUnit = !unitRegex.test(output[0]) && ((_output$find = output.find(value => unitRegex.test(value))) == null ? void 0 : _output$find.replace(numberRegex, '')); + let i = 0; + return output[0].replace(numberRegex, () => `${interpolators[i++](input)}${missingUnit || ''}`).replace(rgbaRegex, rgbaRound); + }; +}; + +const prefix = 'react-spring: '; + +const once = fn => { + const func = fn; + let called = false; + + if (typeof func != 'function') { + throw new TypeError(`${prefix}once requires a function parameter`); + } + + return (...args) => { + if (!called) { + func(...args); + called = true; + } + }; +}; + +const warnInterpolate = once(console.warn); +function react_spring_shared_esm_deprecateInterpolate() { + warnInterpolate(`${prefix}The "interpolate" function is deprecated in v9 (use "to" instead)`); +} +const warnDirectCall = once(console.warn); +function deprecateDirectCall() { + warnDirectCall(`${prefix}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`); +} + +function isAnimatedString(value) { + return react_spring_shared_esm_is.str(value) && (value[0] == '#' || /\d/.test(value) || !isSSR() && cssVariableRegex.test(value) || value in (colors$1 || {})); +} + +const react_spring_shared_esm_useIsomorphicLayoutEffect = isSSR() ? external_React_.useEffect : external_React_.useLayoutEffect; + +const useIsMounted = () => { + const isMounted = (0,external_React_.useRef)(false); + react_spring_shared_esm_useIsomorphicLayoutEffect(() => { + isMounted.current = true; + return () => { + isMounted.current = false; + }; + }, []); + return isMounted; +}; + +function react_spring_shared_esm_useForceUpdate() { + const update = (0,external_React_.useState)()[1]; + const isMounted = useIsMounted(); + return () => { + if (isMounted.current) { + update(Math.random()); + } + }; +} + +function useMemoOne(getResult, inputs) { + const [initial] = (0,external_React_.useState)(() => ({ + inputs, + result: getResult() + })); + const committed = (0,external_React_.useRef)(); + const prevCache = committed.current; + let cache = prevCache; + + if (cache) { + const useCache = Boolean(inputs && cache.inputs && areInputsEqual(inputs, cache.inputs)); + + if (!useCache) { + cache = { + inputs, + result: getResult() + }; + } + } else { + cache = initial; + } + + (0,external_React_.useEffect)(() => { + committed.current = cache; + + if (prevCache == initial) { + initial.inputs = initial.result = undefined; + } + }, [cache]); + return cache.result; +} + +function areInputsEqual(next, prev) { + if (next.length !== prev.length) { + return false; + } + + for (let i = 0; i < next.length; i++) { + if (next[i] !== prev[i]) { + return false; + } + } + + return true; +} + +const react_spring_shared_esm_useOnce = effect => (0,external_React_.useEffect)(effect, emptyDeps); +const emptyDeps = []; + +function react_spring_shared_esm_usePrev(value) { + const prevRef = (0,external_React_.useRef)(); + (0,external_React_.useEffect)(() => { + prevRef.current = value; + }); + return prevRef.current; +} + +const useReducedMotion = () => { + const [reducedMotion, setReducedMotion] = useState(null); + react_spring_shared_esm_useIsomorphicLayoutEffect(() => { + const mql = window.matchMedia('(prefers-reduced-motion)'); + + const handleMediaChange = e => { + setReducedMotion(e.matches); + react_spring_shared_esm_assign({ + skipAnimation: e.matches + }); + }; + + handleMediaChange(mql); + mql.addEventListener('change', handleMediaChange); + return () => { + mql.removeEventListener('change', handleMediaChange); + }; + }, []); + return reducedMotion; +}; + + + +;// CONCATENATED MODULE: ./node_modules/@react-spring/animated/dist/react-spring-animated.esm.js + + + + +const $node = Symbol.for('Animated:node'); +const isAnimated = value => !!value && value[$node] === value; +const getAnimated = owner => owner && owner[$node]; +const setAnimated = (owner, node) => defineHidden(owner, $node, node); +const getPayload = owner => owner && owner[$node] && owner[$node].getPayload(); +class Animated { + constructor() { + this.payload = void 0; + setAnimated(this, this); + } + + getPayload() { + return this.payload || []; + } + +} + +class AnimatedValue extends Animated { + constructor(_value) { + super(); + this.done = true; + this.elapsedTime = void 0; + this.lastPosition = void 0; + this.lastVelocity = void 0; + this.v0 = void 0; + this.durationProgress = 0; + this._value = _value; + + if (react_spring_shared_esm_is.num(this._value)) { + this.lastPosition = this._value; + } + } + + static create(value) { + return new AnimatedValue(value); + } + + getPayload() { + return [this]; + } + + getValue() { + return this._value; + } + + setValue(value, step) { + if (react_spring_shared_esm_is.num(value)) { + this.lastPosition = value; + + if (step) { + value = Math.round(value / step) * step; + + if (this.done) { + this.lastPosition = value; + } + } + } + + if (this._value === value) { + return false; + } + + this._value = value; + return true; + } + + reset() { + const { + done + } = this; + this.done = false; + + if (react_spring_shared_esm_is.num(this._value)) { + this.elapsedTime = 0; + this.durationProgress = 0; + this.lastPosition = this._value; + if (done) this.lastVelocity = null; + this.v0 = null; + } + } + +} + +class AnimatedString extends AnimatedValue { + constructor(value) { + super(0); + this._string = null; + this._toString = void 0; + this._toString = createInterpolator({ + output: [value, value] + }); + } + + static create(value) { + return new AnimatedString(value); + } + + getValue() { + let value = this._string; + return value == null ? this._string = this._toString(this._value) : value; + } + + setValue(value) { + if (react_spring_shared_esm_is.str(value)) { + if (value == this._string) { + return false; + } + + this._string = value; + this._value = 1; + } else if (super.setValue(value)) { + this._string = null; + } else { + return false; + } + + return true; + } + + reset(goal) { + if (goal) { + this._toString = createInterpolator({ + output: [this.getValue(), goal] + }); + } + + this._value = 0; + super.reset(); + } + +} + +const TreeContext = { + dependencies: null +}; + +class AnimatedObject extends Animated { + constructor(source) { + super(); + this.source = source; + this.setValue(source); + } + + getValue(animated) { + const values = {}; + eachProp(this.source, (source, key) => { + if (isAnimated(source)) { + values[key] = source.getValue(animated); + } else if (hasFluidValue(source)) { + values[key] = getFluidValue(source); + } else if (!animated) { + values[key] = source; + } + }); + return values; + } + + setValue(source) { + this.source = source; + this.payload = this._makePayload(source); + } + + reset() { + if (this.payload) { + react_spring_shared_esm_each(this.payload, node => node.reset()); + } + } + + _makePayload(source) { + if (source) { + const payload = new Set(); + eachProp(source, this._addToPayload, payload); + return Array.from(payload); + } + } + + _addToPayload(source) { + if (TreeContext.dependencies && hasFluidValue(source)) { + TreeContext.dependencies.add(source); + } + + const payload = getPayload(source); + + if (payload) { + react_spring_shared_esm_each(payload, node => this.add(node)); + } + } + +} + +class AnimatedArray extends AnimatedObject { + constructor(source) { + super(source); + } + + static create(source) { + return new AnimatedArray(source); + } + + getValue() { + return this.source.map(node => node.getValue()); + } + + setValue(source) { + const payload = this.getPayload(); + + if (source.length == payload.length) { + return payload.map((node, i) => node.setValue(source[i])).some(Boolean); + } + + super.setValue(source.map(makeAnimated)); + return true; + } + +} + +function makeAnimated(value) { + const nodeType = isAnimatedString(value) ? AnimatedString : AnimatedValue; + return nodeType.create(value); +} + +function getAnimatedType(value) { + const parentNode = getAnimated(value); + return parentNode ? parentNode.constructor : react_spring_shared_esm_is.arr(value) ? AnimatedArray : isAnimatedString(value) ? AnimatedString : AnimatedValue; +} + +function react_spring_animated_esm_extends() { + react_spring_animated_esm_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 react_spring_animated_esm_extends.apply(this, arguments); +} + +const withAnimated = (Component, host) => { + const hasInstance = !react_spring_shared_esm_is.fun(Component) || Component.prototype && Component.prototype.isReactComponent; + return (0,external_React_.forwardRef)((givenProps, givenRef) => { + const instanceRef = (0,external_React_.useRef)(null); + const ref = hasInstance && (0,external_React_.useCallback)(value => { + instanceRef.current = updateRef(givenRef, value); + }, [givenRef]); + const [props, deps] = getAnimatedState(givenProps, host); + const forceUpdate = react_spring_shared_esm_useForceUpdate(); + + const callback = () => { + const instance = instanceRef.current; + + if (hasInstance && !instance) { + return; + } + + const didUpdate = instance ? host.applyAnimatedValues(instance, props.getValue(true)) : false; + + if (didUpdate === false) { + forceUpdate(); + } + }; + + const observer = new PropsObserver(callback, deps); + const observerRef = (0,external_React_.useRef)(); + react_spring_shared_esm_useIsomorphicLayoutEffect(() => { + observerRef.current = observer; + react_spring_shared_esm_each(deps, dep => addFluidObserver(dep, observer)); + return () => { + if (observerRef.current) { + react_spring_shared_esm_each(observerRef.current.deps, dep => removeFluidObserver(dep, observerRef.current)); + raf.cancel(observerRef.current.update); + } + }; + }); + (0,external_React_.useEffect)(callback, []); + react_spring_shared_esm_useOnce(() => () => { + const observer = observerRef.current; + react_spring_shared_esm_each(observer.deps, dep => removeFluidObserver(dep, observer)); + }); + const usedProps = host.getComponentProps(props.getValue()); + return external_React_.createElement(Component, react_spring_animated_esm_extends({}, usedProps, { + ref: ref + })); + }); +}; + +class PropsObserver { + constructor(update, deps) { + this.update = update; + this.deps = deps; + } + + eventObserved(event) { + if (event.type == 'change') { + raf.write(this.update); + } + } + +} + +function getAnimatedState(props, host) { + const dependencies = new Set(); + TreeContext.dependencies = dependencies; + if (props.style) props = react_spring_animated_esm_extends({}, props, { + style: host.createAnimatedStyle(props.style) + }); + props = new AnimatedObject(props); + TreeContext.dependencies = null; + return [props, dependencies]; +} + +function updateRef(ref, value) { + if (ref) { + if (react_spring_shared_esm_is.fun(ref)) ref(value);else ref.current = value; + } + + return value; +} + +const cacheKey = Symbol.for('AnimatedComponent'); +const createHost = (components, { + applyAnimatedValues: _applyAnimatedValues = () => false, + createAnimatedStyle: _createAnimatedStyle = style => new AnimatedObject(style), + getComponentProps: _getComponentProps = props => props +} = {}) => { + const hostConfig = { + applyAnimatedValues: _applyAnimatedValues, + createAnimatedStyle: _createAnimatedStyle, + getComponentProps: _getComponentProps + }; + + const animated = Component => { + const displayName = getDisplayName(Component) || 'Anonymous'; + + if (react_spring_shared_esm_is.str(Component)) { + Component = animated[Component] || (animated[Component] = withAnimated(Component, hostConfig)); + } else { + Component = Component[cacheKey] || (Component[cacheKey] = withAnimated(Component, hostConfig)); + } + + Component.displayName = `Animated(${displayName})`; + return Component; + }; + + eachProp(components, (Component, key) => { + if (react_spring_shared_esm_is.arr(components)) { + key = getDisplayName(Component); + } + + animated[key] = animated(Component); + }); + return { + animated + }; +}; + +const getDisplayName = arg => react_spring_shared_esm_is.str(arg) ? arg : arg && react_spring_shared_esm_is.str(arg.displayName) ? arg.displayName : react_spring_shared_esm_is.fun(arg) && arg.name || null; + + + +;// CONCATENATED MODULE: ./node_modules/@react-spring/core/dist/react-spring-core.esm.js + + + + + + + + +function react_spring_core_esm_extends() { + react_spring_core_esm_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 react_spring_core_esm_extends.apply(this, arguments); +} + +function callProp(value, ...args) { + return react_spring_shared_esm_is.fun(value) ? value(...args) : value; +} +const matchProp = (value, key) => value === true || !!(key && value && (react_spring_shared_esm_is.fun(value) ? value(key) : react_spring_shared_esm_toArray(value).includes(key))); +const resolveProp = (prop, key) => react_spring_shared_esm_is.obj(prop) ? key && prop[key] : prop; +const getDefaultProp = (props, key) => props.default === true ? props[key] : props.default ? props.default[key] : undefined; + +const noopTransform = value => value; + +const getDefaultProps = (props, transform = noopTransform) => { + let keys = DEFAULT_PROPS; + + if (props.default && props.default !== true) { + props = props.default; + keys = Object.keys(props); + } + + const defaults = {}; + + for (const key of keys) { + const value = transform(props[key], key); + + if (!react_spring_shared_esm_is.und(value)) { + defaults[key] = value; + } + } + + return defaults; +}; +const DEFAULT_PROPS = ['config', 'onProps', 'onStart', 'onChange', 'onPause', 'onResume', 'onRest']; +const RESERVED_PROPS = { + config: 1, + from: 1, + to: 1, + ref: 1, + loop: 1, + reset: 1, + pause: 1, + cancel: 1, + reverse: 1, + immediate: 1, + default: 1, + delay: 1, + onProps: 1, + onStart: 1, + onChange: 1, + onPause: 1, + onResume: 1, + onRest: 1, + onResolve: 1, + items: 1, + trail: 1, + sort: 1, + expires: 1, + initial: 1, + enter: 1, + update: 1, + leave: 1, + children: 1, + onDestroyed: 1, + keys: 1, + callId: 1, + parentId: 1 +}; + +function getForwardProps(props) { + const forward = {}; + let count = 0; + eachProp(props, (value, prop) => { + if (!RESERVED_PROPS[prop]) { + forward[prop] = value; + count++; + } + }); + + if (count) { + return forward; + } +} + +function inferTo(props) { + const to = getForwardProps(props); + + if (to) { + const out = { + to + }; + eachProp(props, (val, key) => key in to || (out[key] = val)); + return out; + } + + return react_spring_core_esm_extends({}, props); +} +function computeGoal(value) { + value = getFluidValue(value); + return react_spring_shared_esm_is.arr(value) ? value.map(computeGoal) : isAnimatedString(value) ? globals.createStringInterpolator({ + range: [0, 1], + output: [value, value] + })(1) : value; +} +function hasProps(props) { + for (const _ in props) return true; + + return false; +} +function isAsyncTo(to) { + return react_spring_shared_esm_is.fun(to) || react_spring_shared_esm_is.arr(to) && react_spring_shared_esm_is.obj(to[0]); +} +function detachRefs(ctrl, ref) { + var _ctrl$ref; + + (_ctrl$ref = ctrl.ref) == null ? void 0 : _ctrl$ref.delete(ctrl); + ref == null ? void 0 : ref.delete(ctrl); +} +function replaceRef(ctrl, ref) { + if (ref && ctrl.ref !== ref) { + var _ctrl$ref2; + + (_ctrl$ref2 = ctrl.ref) == null ? void 0 : _ctrl$ref2.delete(ctrl); + ref.add(ctrl); + ctrl.ref = ref; + } +} + +function useChain(refs, timeSteps, timeFrame = 1000) { + useIsomorphicLayoutEffect(() => { + if (timeSteps) { + let prevDelay = 0; + each(refs, (ref, i) => { + const controllers = ref.current; + + if (controllers.length) { + let delay = timeFrame * timeSteps[i]; + if (isNaN(delay)) delay = prevDelay;else prevDelay = delay; + each(controllers, ctrl => { + each(ctrl.queue, props => { + const memoizedDelayProp = props.delay; + + props.delay = key => delay + callProp(memoizedDelayProp || 0, key); + }); + }); + ref.start(); + } + }); + } else { + let p = Promise.resolve(); + each(refs, ref => { + const controllers = ref.current; + + if (controllers.length) { + const queues = controllers.map(ctrl => { + const q = ctrl.queue; + ctrl.queue = []; + return q; + }); + p = p.then(() => { + each(controllers, (ctrl, i) => each(queues[i] || [], update => ctrl.queue.push(update))); + return Promise.all(ref.start()); + }); + } + }); + } + }); +} + +const config = { + default: { + tension: 170, + friction: 26 + }, + gentle: { + tension: 120, + friction: 14 + }, + wobbly: { + tension: 180, + friction: 12 + }, + stiff: { + tension: 210, + friction: 20 + }, + slow: { + tension: 280, + friction: 60 + }, + molasses: { + tension: 280, + friction: 120 + } +}; +const c1 = 1.70158; +const c2 = c1 * 1.525; +const c3 = c1 + 1; +const c4 = 2 * Math.PI / 3; +const c5 = 2 * Math.PI / 4.5; + +const bounceOut = x => { + const n1 = 7.5625; + const d1 = 2.75; + + if (x < 1 / d1) { + return n1 * x * x; + } else if (x < 2 / d1) { + return n1 * (x -= 1.5 / d1) * x + 0.75; + } else if (x < 2.5 / d1) { + return n1 * (x -= 2.25 / d1) * x + 0.9375; + } else { + return n1 * (x -= 2.625 / d1) * x + 0.984375; + } +}; + +const easings = { + linear: x => x, + easeInQuad: x => x * x, + easeOutQuad: x => 1 - (1 - x) * (1 - x), + easeInOutQuad: x => x < 0.5 ? 2 * x * x : 1 - Math.pow(-2 * x + 2, 2) / 2, + easeInCubic: x => x * x * x, + easeOutCubic: x => 1 - Math.pow(1 - x, 3), + easeInOutCubic: x => x < 0.5 ? 4 * x * x * x : 1 - Math.pow(-2 * x + 2, 3) / 2, + easeInQuart: x => x * x * x * x, + easeOutQuart: x => 1 - Math.pow(1 - x, 4), + easeInOutQuart: x => x < 0.5 ? 8 * x * x * x * x : 1 - Math.pow(-2 * x + 2, 4) / 2, + easeInQuint: x => x * x * x * x * x, + easeOutQuint: x => 1 - Math.pow(1 - x, 5), + easeInOutQuint: x => x < 0.5 ? 16 * x * x * x * x * x : 1 - Math.pow(-2 * x + 2, 5) / 2, + easeInSine: x => 1 - Math.cos(x * Math.PI / 2), + easeOutSine: x => Math.sin(x * Math.PI / 2), + easeInOutSine: x => -(Math.cos(Math.PI * x) - 1) / 2, + easeInExpo: x => x === 0 ? 0 : Math.pow(2, 10 * x - 10), + easeOutExpo: x => x === 1 ? 1 : 1 - Math.pow(2, -10 * x), + easeInOutExpo: x => x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? Math.pow(2, 20 * x - 10) / 2 : (2 - Math.pow(2, -20 * x + 10)) / 2, + easeInCirc: x => 1 - Math.sqrt(1 - Math.pow(x, 2)), + easeOutCirc: x => Math.sqrt(1 - Math.pow(x - 1, 2)), + easeInOutCirc: x => x < 0.5 ? (1 - Math.sqrt(1 - Math.pow(2 * x, 2))) / 2 : (Math.sqrt(1 - Math.pow(-2 * x + 2, 2)) + 1) / 2, + easeInBack: x => c3 * x * x * x - c1 * x * x, + easeOutBack: x => 1 + c3 * Math.pow(x - 1, 3) + c1 * Math.pow(x - 1, 2), + easeInOutBack: x => x < 0.5 ? Math.pow(2 * x, 2) * ((c2 + 1) * 2 * x - c2) / 2 : (Math.pow(2 * x - 2, 2) * ((c2 + 1) * (x * 2 - 2) + c2) + 2) / 2, + easeInElastic: x => x === 0 ? 0 : x === 1 ? 1 : -Math.pow(2, 10 * x - 10) * Math.sin((x * 10 - 10.75) * c4), + easeOutElastic: x => x === 0 ? 0 : x === 1 ? 1 : Math.pow(2, -10 * x) * Math.sin((x * 10 - 0.75) * c4) + 1, + easeInOutElastic: x => x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? -(Math.pow(2, 20 * x - 10) * Math.sin((20 * x - 11.125) * c5)) / 2 : Math.pow(2, -20 * x + 10) * Math.sin((20 * x - 11.125) * c5) / 2 + 1, + easeInBounce: x => 1 - bounceOut(1 - x), + easeOutBounce: bounceOut, + easeInOutBounce: x => x < 0.5 ? (1 - bounceOut(1 - 2 * x)) / 2 : (1 + bounceOut(2 * x - 1)) / 2 +}; + +const defaults = react_spring_core_esm_extends({}, config.default, { + mass: 1, + damping: 1, + easing: easings.linear, + clamp: false +}); + +class AnimationConfig { + constructor() { + this.tension = void 0; + this.friction = void 0; + this.frequency = void 0; + this.damping = void 0; + this.mass = void 0; + this.velocity = 0; + this.restVelocity = void 0; + this.precision = void 0; + this.progress = void 0; + this.duration = void 0; + this.easing = void 0; + this.clamp = void 0; + this.bounce = void 0; + this.decay = void 0; + this.round = void 0; + Object.assign(this, defaults); + } + +} +function mergeConfig(config, newConfig, defaultConfig) { + if (defaultConfig) { + defaultConfig = react_spring_core_esm_extends({}, defaultConfig); + sanitizeConfig(defaultConfig, newConfig); + newConfig = react_spring_core_esm_extends({}, defaultConfig, newConfig); + } + + sanitizeConfig(config, newConfig); + Object.assign(config, newConfig); + + for (const key in defaults) { + if (config[key] == null) { + config[key] = defaults[key]; + } + } + + let { + mass, + frequency, + damping + } = config; + + if (!react_spring_shared_esm_is.und(frequency)) { + if (frequency < 0.01) frequency = 0.01; + if (damping < 0) damping = 0; + config.tension = Math.pow(2 * Math.PI / frequency, 2) * mass; + config.friction = 4 * Math.PI * damping * mass / frequency; + } + + return config; +} + +function sanitizeConfig(config, props) { + if (!react_spring_shared_esm_is.und(props.decay)) { + config.duration = undefined; + } else { + const isTensionConfig = !react_spring_shared_esm_is.und(props.tension) || !react_spring_shared_esm_is.und(props.friction); + + if (isTensionConfig || !react_spring_shared_esm_is.und(props.frequency) || !react_spring_shared_esm_is.und(props.damping) || !react_spring_shared_esm_is.und(props.mass)) { + config.duration = undefined; + config.decay = undefined; + } + + if (isTensionConfig) { + config.frequency = undefined; + } + } +} + +const emptyArray = []; +class Animation { + constructor() { + this.changed = false; + this.values = emptyArray; + this.toValues = null; + this.fromValues = emptyArray; + this.to = void 0; + this.from = void 0; + this.config = new AnimationConfig(); + this.immediate = false; + } + +} + +function scheduleProps(callId, { + key, + props, + defaultProps, + state, + actions +}) { + return new Promise((resolve, reject) => { + var _props$cancel; + + let delay; + let timeout; + let cancel = matchProp((_props$cancel = props.cancel) != null ? _props$cancel : defaultProps == null ? void 0 : defaultProps.cancel, key); + + if (cancel) { + onStart(); + } else { + if (!react_spring_shared_esm_is.und(props.pause)) { + state.paused = matchProp(props.pause, key); + } + + let pause = defaultProps == null ? void 0 : defaultProps.pause; + + if (pause !== true) { + pause = state.paused || matchProp(pause, key); + } + + delay = callProp(props.delay || 0, key); + + if (pause) { + state.resumeQueue.add(onResume); + actions.pause(); + } else { + actions.resume(); + onResume(); + } + } + + function onPause() { + state.resumeQueue.add(onResume); + state.timeouts.delete(timeout); + timeout.cancel(); + delay = timeout.time - raf.now(); + } + + function onResume() { + if (delay > 0 && !globals.skipAnimation) { + state.delayed = true; + timeout = raf.setTimeout(onStart, delay); + state.pauseQueue.add(onPause); + state.timeouts.add(timeout); + } else { + onStart(); + } + } + + function onStart() { + if (state.delayed) { + state.delayed = false; + } + + state.pauseQueue.delete(onPause); + state.timeouts.delete(timeout); + + if (callId <= (state.cancelId || 0)) { + cancel = true; + } + + try { + actions.start(react_spring_core_esm_extends({}, props, { + callId, + cancel + }), resolve); + } catch (err) { + reject(err); + } + } + }); +} + +const getCombinedResult = (target, results) => results.length == 1 ? results[0] : results.some(result => result.cancelled) ? getCancelledResult(target.get()) : results.every(result => result.noop) ? getNoopResult(target.get()) : getFinishedResult(target.get(), results.every(result => result.finished)); +const getNoopResult = value => ({ + value, + noop: true, + finished: true, + cancelled: false +}); +const getFinishedResult = (value, finished, cancelled = false) => ({ + value, + finished, + cancelled +}); +const getCancelledResult = value => ({ + value, + cancelled: true, + finished: false +}); + +function runAsync(to, props, state, target) { + const { + callId, + parentId, + onRest + } = props; + const { + asyncTo: prevTo, + promise: prevPromise + } = state; + + if (!parentId && to === prevTo && !props.reset) { + return prevPromise; + } + + return state.promise = (async () => { + state.asyncId = callId; + state.asyncTo = to; + const defaultProps = getDefaultProps(props, (value, key) => key === 'onRest' ? undefined : value); + let preventBail; + let bail; + const bailPromise = new Promise((resolve, reject) => (preventBail = resolve, bail = reject)); + + const bailIfEnded = bailSignal => { + const bailResult = callId <= (state.cancelId || 0) && getCancelledResult(target) || callId !== state.asyncId && getFinishedResult(target, false); + + if (bailResult) { + bailSignal.result = bailResult; + bail(bailSignal); + throw bailSignal; + } + }; + + const animate = (arg1, arg2) => { + const bailSignal = new BailSignal(); + const skipAnimationSignal = new SkipAniamtionSignal(); + return (async () => { + if (globals.skipAnimation) { + stopAsync(state); + skipAnimationSignal.result = getFinishedResult(target, false); + bail(skipAnimationSignal); + throw skipAnimationSignal; + } + + bailIfEnded(bailSignal); + const props = react_spring_shared_esm_is.obj(arg1) ? react_spring_core_esm_extends({}, arg1) : react_spring_core_esm_extends({}, arg2, { + to: arg1 + }); + props.parentId = callId; + eachProp(defaultProps, (value, key) => { + if (react_spring_shared_esm_is.und(props[key])) { + props[key] = value; + } + }); + const result = await target.start(props); + bailIfEnded(bailSignal); + + if (state.paused) { + await new Promise(resume => { + state.resumeQueue.add(resume); + }); + } + + return result; + })(); + }; + + let result; + + if (globals.skipAnimation) { + stopAsync(state); + return getFinishedResult(target, false); + } + + try { + let animating; + + if (react_spring_shared_esm_is.arr(to)) { + animating = (async queue => { + for (const props of queue) { + await animate(props); + } + })(to); + } else { + animating = Promise.resolve(to(animate, target.stop.bind(target))); + } + + await Promise.all([animating.then(preventBail), bailPromise]); + result = getFinishedResult(target.get(), true, false); + } catch (err) { + if (err instanceof BailSignal) { + result = err.result; + } else if (err instanceof SkipAniamtionSignal) { + result = err.result; + } else { + throw err; + } + } finally { + if (callId == state.asyncId) { + state.asyncId = parentId; + state.asyncTo = parentId ? prevTo : undefined; + state.promise = parentId ? prevPromise : undefined; + } + } + + if (react_spring_shared_esm_is.fun(onRest)) { + raf.batchedUpdates(() => { + onRest(result, target, target.item); + }); + } + + return result; + })(); +} +function stopAsync(state, cancelId) { + flush(state.timeouts, t => t.cancel()); + state.pauseQueue.clear(); + state.resumeQueue.clear(); + state.asyncId = state.asyncTo = state.promise = undefined; + if (cancelId) state.cancelId = cancelId; +} +class BailSignal extends Error { + constructor() { + super('An async animation has been interrupted. You see this error because you ' + 'forgot to use `await` or `.catch(...)` on its returned promise.'); + this.result = void 0; + } + +} +class SkipAniamtionSignal extends Error { + constructor() { + super('SkipAnimationSignal'); + this.result = void 0; + } + +} + +const isFrameValue = value => value instanceof FrameValue; +let nextId$1 = 1; +class FrameValue extends FluidValue { + constructor(...args) { + super(...args); + this.id = nextId$1++; + this.key = void 0; + this._priority = 0; + } + + get priority() { + return this._priority; + } + + set priority(priority) { + if (this._priority != priority) { + this._priority = priority; + + this._onPriorityChange(priority); + } + } + + get() { + const node = getAnimated(this); + return node && node.getValue(); + } + + to(...args) { + return globals.to(this, args); + } + + interpolate(...args) { + react_spring_shared_esm_deprecateInterpolate(); + return globals.to(this, args); + } + + toJSON() { + return this.get(); + } + + observerAdded(count) { + if (count == 1) this._attach(); + } + + observerRemoved(count) { + if (count == 0) this._detach(); + } + + _attach() {} + + _detach() {} + + _onChange(value, idle = false) { + callFluidObservers(this, { + type: 'change', + parent: this, + value, + idle + }); + } + + _onPriorityChange(priority) { + if (!this.idle) { + frameLoop.sort(this); + } + + callFluidObservers(this, { + type: 'priority', + parent: this, + priority + }); + } + +} + +const $P = Symbol.for('SpringPhase'); +const HAS_ANIMATED = 1; +const IS_ANIMATING = 2; +const IS_PAUSED = 4; +const hasAnimated = target => (target[$P] & HAS_ANIMATED) > 0; +const isAnimating = target => (target[$P] & IS_ANIMATING) > 0; +const isPaused = target => (target[$P] & IS_PAUSED) > 0; +const setActiveBit = (target, active) => active ? target[$P] |= IS_ANIMATING | HAS_ANIMATED : target[$P] &= ~IS_ANIMATING; +const setPausedBit = (target, paused) => paused ? target[$P] |= IS_PAUSED : target[$P] &= ~IS_PAUSED; + +class SpringValue extends FrameValue { + constructor(arg1, arg2) { + super(); + this.key = void 0; + this.animation = new Animation(); + this.queue = void 0; + this.defaultProps = {}; + this._state = { + paused: false, + delayed: false, + pauseQueue: new Set(), + resumeQueue: new Set(), + timeouts: new Set() + }; + this._pendingCalls = new Set(); + this._lastCallId = 0; + this._lastToId = 0; + this._memoizedDuration = 0; + + if (!react_spring_shared_esm_is.und(arg1) || !react_spring_shared_esm_is.und(arg2)) { + const props = react_spring_shared_esm_is.obj(arg1) ? react_spring_core_esm_extends({}, arg1) : react_spring_core_esm_extends({}, arg2, { + from: arg1 + }); + + if (react_spring_shared_esm_is.und(props.default)) { + props.default = true; + } + + this.start(props); + } + } + + get idle() { + return !(isAnimating(this) || this._state.asyncTo) || isPaused(this); + } + + get goal() { + return getFluidValue(this.animation.to); + } + + get velocity() { + const node = getAnimated(this); + return node instanceof AnimatedValue ? node.lastVelocity || 0 : node.getPayload().map(node => node.lastVelocity || 0); + } + + get hasAnimated() { + return hasAnimated(this); + } + + get isAnimating() { + return isAnimating(this); + } + + get isPaused() { + return isPaused(this); + } + + get isDelayed() { + return this._state.delayed; + } + + advance(dt) { + let idle = true; + let changed = false; + const anim = this.animation; + let { + config, + toValues + } = anim; + const payload = getPayload(anim.to); + + if (!payload && hasFluidValue(anim.to)) { + toValues = react_spring_shared_esm_toArray(getFluidValue(anim.to)); + } + + anim.values.forEach((node, i) => { + if (node.done) return; + const to = node.constructor == AnimatedString ? 1 : payload ? payload[i].lastPosition : toValues[i]; + let finished = anim.immediate; + let position = to; + + if (!finished) { + position = node.lastPosition; + + if (config.tension <= 0) { + node.done = true; + return; + } + + let elapsed = node.elapsedTime += dt; + const from = anim.fromValues[i]; + const v0 = node.v0 != null ? node.v0 : node.v0 = react_spring_shared_esm_is.arr(config.velocity) ? config.velocity[i] : config.velocity; + let velocity; + + if (!react_spring_shared_esm_is.und(config.duration)) { + let p = 1; + + if (config.duration > 0) { + if (this._memoizedDuration !== config.duration) { + this._memoizedDuration = config.duration; + + if (node.durationProgress > 0) { + node.elapsedTime = config.duration * node.durationProgress; + elapsed = node.elapsedTime += dt; + } + } + + p = (config.progress || 0) + elapsed / this._memoizedDuration; + p = p > 1 ? 1 : p < 0 ? 0 : p; + node.durationProgress = p; + } + + position = from + config.easing(p) * (to - from); + velocity = (position - node.lastPosition) / dt; + finished = p == 1; + } else if (config.decay) { + const decay = config.decay === true ? 0.998 : config.decay; + const e = Math.exp(-(1 - decay) * elapsed); + position = from + v0 / (1 - decay) * (1 - e); + finished = Math.abs(node.lastPosition - position) < 0.1; + velocity = v0 * e; + } else { + velocity = node.lastVelocity == null ? v0 : node.lastVelocity; + const precision = config.precision || (from == to ? 0.005 : Math.min(1, Math.abs(to - from) * 0.001)); + const restVelocity = config.restVelocity || precision / 10; + const bounceFactor = config.clamp ? 0 : config.bounce; + const canBounce = !react_spring_shared_esm_is.und(bounceFactor); + const isGrowing = from == to ? node.v0 > 0 : from < to; + let isMoving; + let isBouncing = false; + const step = 1; + const numSteps = Math.ceil(dt / step); + + for (let n = 0; n < numSteps; ++n) { + isMoving = Math.abs(velocity) > restVelocity; + + if (!isMoving) { + finished = Math.abs(to - position) <= precision; + + if (finished) { + break; + } + } + + if (canBounce) { + isBouncing = position == to || position > to == isGrowing; + + if (isBouncing) { + velocity = -velocity * bounceFactor; + position = to; + } + } + + const springForce = -config.tension * 0.000001 * (position - to); + const dampingForce = -config.friction * 0.001 * velocity; + const acceleration = (springForce + dampingForce) / config.mass; + velocity = velocity + acceleration * step; + position = position + velocity * step; + } + } + + node.lastVelocity = velocity; + + if (Number.isNaN(position)) { + console.warn(`Got NaN while animating:`, this); + finished = true; + } + } + + if (payload && !payload[i].done) { + finished = false; + } + + if (finished) { + node.done = true; + } else { + idle = false; + } + + if (node.setValue(position, config.round)) { + changed = true; + } + }); + const node = getAnimated(this); + const currVal = node.getValue(); + + if (idle) { + const finalVal = getFluidValue(anim.to); + + if ((currVal !== finalVal || changed) && !config.decay) { + node.setValue(finalVal); + + this._onChange(finalVal); + } else if (changed && config.decay) { + this._onChange(currVal); + } + + this._stop(); + } else if (changed) { + this._onChange(currVal); + } + } + + set(value) { + raf.batchedUpdates(() => { + this._stop(); + + this._focus(value); + + this._set(value); + }); + return this; + } + + pause() { + this._update({ + pause: true + }); + } + + resume() { + this._update({ + pause: false + }); + } + + finish() { + if (isAnimating(this)) { + const { + to, + config + } = this.animation; + raf.batchedUpdates(() => { + this._onStart(); + + if (!config.decay) { + this._set(to, false); + } + + this._stop(); + }); + } + + return this; + } + + update(props) { + const queue = this.queue || (this.queue = []); + queue.push(props); + return this; + } + + start(to, arg2) { + let queue; + + if (!react_spring_shared_esm_is.und(to)) { + queue = [react_spring_shared_esm_is.obj(to) ? to : react_spring_core_esm_extends({}, arg2, { + to + })]; + } else { + queue = this.queue || []; + this.queue = []; + } + + return Promise.all(queue.map(props => { + const up = this._update(props); + + return up; + })).then(results => getCombinedResult(this, results)); + } + + stop(cancel) { + const { + to + } = this.animation; + + this._focus(this.get()); + + stopAsync(this._state, cancel && this._lastCallId); + raf.batchedUpdates(() => this._stop(to, cancel)); + return this; + } + + reset() { + this._update({ + reset: true + }); + } + + eventObserved(event) { + if (event.type == 'change') { + this._start(); + } else if (event.type == 'priority') { + this.priority = event.priority + 1; + } + } + + _prepareNode(props) { + const key = this.key || ''; + let { + to, + from + } = props; + to = react_spring_shared_esm_is.obj(to) ? to[key] : to; + + if (to == null || isAsyncTo(to)) { + to = undefined; + } + + from = react_spring_shared_esm_is.obj(from) ? from[key] : from; + + if (from == null) { + from = undefined; + } + + const range = { + to, + from + }; + + if (!hasAnimated(this)) { + if (props.reverse) [to, from] = [from, to]; + from = getFluidValue(from); + + if (!react_spring_shared_esm_is.und(from)) { + this._set(from); + } else if (!getAnimated(this)) { + this._set(to); + } + } + + return range; + } + + _update(_ref, isLoop) { + let props = react_spring_core_esm_extends({}, _ref); + + const { + key, + defaultProps + } = this; + if (props.default) Object.assign(defaultProps, getDefaultProps(props, (value, prop) => /^on/.test(prop) ? resolveProp(value, key) : value)); + mergeActiveFn(this, props, 'onProps'); + sendEvent(this, 'onProps', props, this); + + const range = this._prepareNode(props); + + if (Object.isFrozen(this)) { + throw Error('Cannot animate a `SpringValue` object that is frozen. ' + 'Did you forget to pass your component to `animated(...)` before animating its props?'); + } + + const state = this._state; + return scheduleProps(++this._lastCallId, { + key, + props, + defaultProps, + state, + actions: { + pause: () => { + if (!isPaused(this)) { + setPausedBit(this, true); + flushCalls(state.pauseQueue); + sendEvent(this, 'onPause', getFinishedResult(this, checkFinished(this, this.animation.to)), this); + } + }, + resume: () => { + if (isPaused(this)) { + setPausedBit(this, false); + + if (isAnimating(this)) { + this._resume(); + } + + flushCalls(state.resumeQueue); + sendEvent(this, 'onResume', getFinishedResult(this, checkFinished(this, this.animation.to)), this); + } + }, + start: this._merge.bind(this, range) + } + }).then(result => { + if (props.loop && result.finished && !(isLoop && result.noop)) { + const nextProps = createLoopUpdate(props); + + if (nextProps) { + return this._update(nextProps, true); + } + } + + return result; + }); + } + + _merge(range, props, resolve) { + if (props.cancel) { + this.stop(true); + return resolve(getCancelledResult(this)); + } + + const hasToProp = !react_spring_shared_esm_is.und(range.to); + const hasFromProp = !react_spring_shared_esm_is.und(range.from); + + if (hasToProp || hasFromProp) { + if (props.callId > this._lastToId) { + this._lastToId = props.callId; + } else { + return resolve(getCancelledResult(this)); + } + } + + const { + key, + defaultProps, + animation: anim + } = this; + const { + to: prevTo, + from: prevFrom + } = anim; + let { + to = prevTo, + from = prevFrom + } = range; + + if (hasFromProp && !hasToProp && (!props.default || react_spring_shared_esm_is.und(to))) { + to = from; + } + + if (props.reverse) [to, from] = [from, to]; + const hasFromChanged = !isEqual(from, prevFrom); + + if (hasFromChanged) { + anim.from = from; + } + + from = getFluidValue(from); + const hasToChanged = !isEqual(to, prevTo); + + if (hasToChanged) { + this._focus(to); + } + + const hasAsyncTo = isAsyncTo(props.to); + const { + config + } = anim; + const { + decay, + velocity + } = config; + + if (hasToProp || hasFromProp) { + config.velocity = 0; + } + + if (props.config && !hasAsyncTo) { + mergeConfig(config, callProp(props.config, key), props.config !== defaultProps.config ? callProp(defaultProps.config, key) : void 0); + } + + let node = getAnimated(this); + + if (!node || react_spring_shared_esm_is.und(to)) { + return resolve(getFinishedResult(this, true)); + } + + const reset = react_spring_shared_esm_is.und(props.reset) ? hasFromProp && !props.default : !react_spring_shared_esm_is.und(from) && matchProp(props.reset, key); + const value = reset ? from : this.get(); + const goal = computeGoal(to); + const isAnimatable = react_spring_shared_esm_is.num(goal) || react_spring_shared_esm_is.arr(goal) || isAnimatedString(goal); + const immediate = !hasAsyncTo && (!isAnimatable || matchProp(defaultProps.immediate || props.immediate, key)); + + if (hasToChanged) { + const nodeType = getAnimatedType(to); + + if (nodeType !== node.constructor) { + if (immediate) { + node = this._set(goal); + } else throw Error(`Cannot animate between ${node.constructor.name} and ${nodeType.name}, as the "to" prop suggests`); + } + } + + const goalType = node.constructor; + let started = hasFluidValue(to); + let finished = false; + + if (!started) { + const hasValueChanged = reset || !hasAnimated(this) && hasFromChanged; + + if (hasToChanged || hasValueChanged) { + finished = isEqual(computeGoal(value), goal); + started = !finished; + } + + if (!isEqual(anim.immediate, immediate) && !immediate || !isEqual(config.decay, decay) || !isEqual(config.velocity, velocity)) { + started = true; + } + } + + if (finished && isAnimating(this)) { + if (anim.changed && !reset) { + started = true; + } else if (!started) { + this._stop(prevTo); + } + } + + if (!hasAsyncTo) { + if (started || hasFluidValue(prevTo)) { + anim.values = node.getPayload(); + anim.toValues = hasFluidValue(to) ? null : goalType == AnimatedString ? [1] : react_spring_shared_esm_toArray(goal); + } + + if (anim.immediate != immediate) { + anim.immediate = immediate; + + if (!immediate && !reset) { + this._set(prevTo); + } + } + + if (started) { + const { + onRest + } = anim; + react_spring_shared_esm_each(ACTIVE_EVENTS, type => mergeActiveFn(this, props, type)); + const result = getFinishedResult(this, checkFinished(this, prevTo)); + flushCalls(this._pendingCalls, result); + + this._pendingCalls.add(resolve); + + if (anim.changed) raf.batchedUpdates(() => { + anim.changed = !reset; + onRest == null ? void 0 : onRest(result, this); + + if (reset) { + callProp(defaultProps.onRest, result); + } else { + anim.onStart == null ? void 0 : anim.onStart(result, this); + } + }); + } + } + + if (reset) { + this._set(value); + } + + if (hasAsyncTo) { + resolve(runAsync(props.to, props, this._state, this)); + } else if (started) { + this._start(); + } else if (isAnimating(this) && !hasToChanged) { + this._pendingCalls.add(resolve); + } else { + resolve(getNoopResult(value)); + } + } + + _focus(value) { + const anim = this.animation; + + if (value !== anim.to) { + if (getFluidObservers(this)) { + this._detach(); + } + + anim.to = value; + + if (getFluidObservers(this)) { + this._attach(); + } + } + } + + _attach() { + let priority = 0; + const { + to + } = this.animation; + + if (hasFluidValue(to)) { + addFluidObserver(to, this); + + if (isFrameValue(to)) { + priority = to.priority + 1; + } + } + + this.priority = priority; + } + + _detach() { + const { + to + } = this.animation; + + if (hasFluidValue(to)) { + removeFluidObserver(to, this); + } + } + + _set(arg, idle = true) { + const value = getFluidValue(arg); + + if (!react_spring_shared_esm_is.und(value)) { + const oldNode = getAnimated(this); + + if (!oldNode || !isEqual(value, oldNode.getValue())) { + const nodeType = getAnimatedType(value); + + if (!oldNode || oldNode.constructor != nodeType) { + setAnimated(this, nodeType.create(value)); + } else { + oldNode.setValue(value); + } + + if (oldNode) { + raf.batchedUpdates(() => { + this._onChange(value, idle); + }); + } + } + } + + return getAnimated(this); + } + + _onStart() { + const anim = this.animation; + + if (!anim.changed) { + anim.changed = true; + sendEvent(this, 'onStart', getFinishedResult(this, checkFinished(this, anim.to)), this); + } + } + + _onChange(value, idle) { + if (!idle) { + this._onStart(); + + callProp(this.animation.onChange, value, this); + } + + callProp(this.defaultProps.onChange, value, this); + + super._onChange(value, idle); + } + + _start() { + const anim = this.animation; + getAnimated(this).reset(getFluidValue(anim.to)); + + if (!anim.immediate) { + anim.fromValues = anim.values.map(node => node.lastPosition); + } + + if (!isAnimating(this)) { + setActiveBit(this, true); + + if (!isPaused(this)) { + this._resume(); + } + } + } + + _resume() { + if (globals.skipAnimation) { + this.finish(); + } else { + frameLoop.start(this); + } + } + + _stop(goal, cancel) { + if (isAnimating(this)) { + setActiveBit(this, false); + const anim = this.animation; + react_spring_shared_esm_each(anim.values, node => { + node.done = true; + }); + + if (anim.toValues) { + anim.onChange = anim.onPause = anim.onResume = undefined; + } + + callFluidObservers(this, { + type: 'idle', + parent: this + }); + const result = cancel ? getCancelledResult(this.get()) : getFinishedResult(this.get(), checkFinished(this, goal != null ? goal : anim.to)); + flushCalls(this._pendingCalls, result); + + if (anim.changed) { + anim.changed = false; + sendEvent(this, 'onRest', result, this); + } + } + } + +} + +function checkFinished(target, to) { + const goal = computeGoal(to); + const value = computeGoal(target.get()); + return isEqual(value, goal); +} + +function createLoopUpdate(props, loop = props.loop, to = props.to) { + let loopRet = callProp(loop); + + if (loopRet) { + const overrides = loopRet !== true && inferTo(loopRet); + const reverse = (overrides || props).reverse; + const reset = !overrides || overrides.reset; + return createUpdate(react_spring_core_esm_extends({}, props, { + loop, + default: false, + pause: undefined, + to: !reverse || isAsyncTo(to) ? to : undefined, + from: reset ? props.from : undefined, + reset + }, overrides)); + } +} +function createUpdate(props) { + const { + to, + from + } = props = inferTo(props); + const keys = new Set(); + if (react_spring_shared_esm_is.obj(to)) findDefined(to, keys); + if (react_spring_shared_esm_is.obj(from)) findDefined(from, keys); + props.keys = keys.size ? Array.from(keys) : null; + return props; +} +function declareUpdate(props) { + const update = createUpdate(props); + + if (react_spring_shared_esm_is.und(update.default)) { + update.default = getDefaultProps(update); + } + + return update; +} + +function findDefined(values, keys) { + eachProp(values, (value, key) => value != null && keys.add(key)); +} + +const ACTIVE_EVENTS = ['onStart', 'onRest', 'onChange', 'onPause', 'onResume']; + +function mergeActiveFn(target, props, type) { + target.animation[type] = props[type] !== getDefaultProp(props, type) ? resolveProp(props[type], target.key) : undefined; +} + +function sendEvent(target, type, ...args) { + var _target$animation$typ, _target$animation, _target$defaultProps$, _target$defaultProps; + + (_target$animation$typ = (_target$animation = target.animation)[type]) == null ? void 0 : _target$animation$typ.call(_target$animation, ...args); + (_target$defaultProps$ = (_target$defaultProps = target.defaultProps)[type]) == null ? void 0 : _target$defaultProps$.call(_target$defaultProps, ...args); +} + +const BATCHED_EVENTS = ['onStart', 'onChange', 'onRest']; +let nextId = 1; +class Controller { + constructor(props, flush) { + this.id = nextId++; + this.springs = {}; + this.queue = []; + this.ref = void 0; + this._flush = void 0; + this._initialProps = void 0; + this._lastAsyncId = 0; + this._active = new Set(); + this._changed = new Set(); + this._started = false; + this._item = void 0; + this._state = { + paused: false, + pauseQueue: new Set(), + resumeQueue: new Set(), + timeouts: new Set() + }; + this._events = { + onStart: new Map(), + onChange: new Map(), + onRest: new Map() + }; + this._onFrame = this._onFrame.bind(this); + + if (flush) { + this._flush = flush; + } + + if (props) { + this.start(react_spring_core_esm_extends({ + default: true + }, props)); + } + } + + get idle() { + return !this._state.asyncTo && Object.values(this.springs).every(spring => { + return spring.idle && !spring.isDelayed && !spring.isPaused; + }); + } + + get item() { + return this._item; + } + + set item(item) { + this._item = item; + } + + get() { + const values = {}; + this.each((spring, key) => values[key] = spring.get()); + return values; + } + + set(values) { + for (const key in values) { + const value = values[key]; + + if (!react_spring_shared_esm_is.und(value)) { + this.springs[key].set(value); + } + } + } + + update(props) { + if (props) { + this.queue.push(createUpdate(props)); + } + + return this; + } + + start(props) { + let { + queue + } = this; + + if (props) { + queue = react_spring_shared_esm_toArray(props).map(createUpdate); + } else { + this.queue = []; + } + + if (this._flush) { + return this._flush(this, queue); + } + + prepareKeys(this, queue); + return flushUpdateQueue(this, queue); + } + + stop(arg, keys) { + if (arg !== !!arg) { + keys = arg; + } + + if (keys) { + const springs = this.springs; + react_spring_shared_esm_each(react_spring_shared_esm_toArray(keys), key => springs[key].stop(!!arg)); + } else { + stopAsync(this._state, this._lastAsyncId); + this.each(spring => spring.stop(!!arg)); + } + + return this; + } + + pause(keys) { + if (react_spring_shared_esm_is.und(keys)) { + this.start({ + pause: true + }); + } else { + const springs = this.springs; + react_spring_shared_esm_each(react_spring_shared_esm_toArray(keys), key => springs[key].pause()); + } + + return this; + } + + resume(keys) { + if (react_spring_shared_esm_is.und(keys)) { + this.start({ + pause: false + }); + } else { + const springs = this.springs; + react_spring_shared_esm_each(react_spring_shared_esm_toArray(keys), key => springs[key].resume()); + } + + return this; + } + + each(iterator) { + eachProp(this.springs, iterator); + } + + _onFrame() { + const { + onStart, + onChange, + onRest + } = this._events; + const active = this._active.size > 0; + const changed = this._changed.size > 0; + + if (active && !this._started || changed && !this._started) { + this._started = true; + flush(onStart, ([onStart, result]) => { + result.value = this.get(); + onStart(result, this, this._item); + }); + } + + const idle = !active && this._started; + const values = changed || idle && onRest.size ? this.get() : null; + + if (changed && onChange.size) { + flush(onChange, ([onChange, result]) => { + result.value = values; + onChange(result, this, this._item); + }); + } + + if (idle) { + this._started = false; + flush(onRest, ([onRest, result]) => { + result.value = values; + onRest(result, this, this._item); + }); + } + } + + eventObserved(event) { + if (event.type == 'change') { + this._changed.add(event.parent); + + if (!event.idle) { + this._active.add(event.parent); + } + } else if (event.type == 'idle') { + this._active.delete(event.parent); + } else return; + + raf.onFrame(this._onFrame); + } + +} +function flushUpdateQueue(ctrl, queue) { + return Promise.all(queue.map(props => flushUpdate(ctrl, props))).then(results => getCombinedResult(ctrl, results)); +} +async function flushUpdate(ctrl, props, isLoop) { + const { + keys, + to, + from, + loop, + onRest, + onResolve + } = props; + const defaults = react_spring_shared_esm_is.obj(props.default) && props.default; + + if (loop) { + props.loop = false; + } + + if (to === false) props.to = null; + if (from === false) props.from = null; + const asyncTo = react_spring_shared_esm_is.arr(to) || react_spring_shared_esm_is.fun(to) ? to : undefined; + + if (asyncTo) { + props.to = undefined; + props.onRest = undefined; + + if (defaults) { + defaults.onRest = undefined; + } + } else { + react_spring_shared_esm_each(BATCHED_EVENTS, key => { + const handler = props[key]; + + if (react_spring_shared_esm_is.fun(handler)) { + const queue = ctrl['_events'][key]; + + props[key] = ({ + finished, + cancelled + }) => { + const result = queue.get(handler); + + if (result) { + if (!finished) result.finished = false; + if (cancelled) result.cancelled = true; + } else { + queue.set(handler, { + value: null, + finished: finished || false, + cancelled: cancelled || false + }); + } + }; + + if (defaults) { + defaults[key] = props[key]; + } + } + }); + } + + const state = ctrl['_state']; + + if (props.pause === !state.paused) { + state.paused = props.pause; + flushCalls(props.pause ? state.pauseQueue : state.resumeQueue); + } else if (state.paused) { + props.pause = true; + } + + const promises = (keys || Object.keys(ctrl.springs)).map(key => ctrl.springs[key].start(props)); + const cancel = props.cancel === true || getDefaultProp(props, 'cancel') === true; + + if (asyncTo || cancel && state.asyncId) { + promises.push(scheduleProps(++ctrl['_lastAsyncId'], { + props, + state, + actions: { + pause: noop, + resume: noop, + + start(props, resolve) { + if (cancel) { + stopAsync(state, ctrl['_lastAsyncId']); + resolve(getCancelledResult(ctrl)); + } else { + props.onRest = onRest; + resolve(runAsync(asyncTo, props, state, ctrl)); + } + } + + } + })); + } + + if (state.paused) { + await new Promise(resume => { + state.resumeQueue.add(resume); + }); + } + + const result = getCombinedResult(ctrl, await Promise.all(promises)); + + if (loop && result.finished && !(isLoop && result.noop)) { + const nextProps = createLoopUpdate(props, loop, to); + + if (nextProps) { + prepareKeys(ctrl, [nextProps]); + return flushUpdate(ctrl, nextProps, true); + } + } + + if (onResolve) { + raf.batchedUpdates(() => onResolve(result, ctrl, ctrl.item)); + } + + return result; +} +function getSprings(ctrl, props) { + const springs = react_spring_core_esm_extends({}, ctrl.springs); + + if (props) { + react_spring_shared_esm_each(react_spring_shared_esm_toArray(props), props => { + if (react_spring_shared_esm_is.und(props.keys)) { + props = createUpdate(props); + } + + if (!react_spring_shared_esm_is.obj(props.to)) { + props = react_spring_core_esm_extends({}, props, { + to: undefined + }); + } + + prepareSprings(springs, props, key => { + return createSpring(key); + }); + }); + } + + setSprings(ctrl, springs); + return springs; +} +function setSprings(ctrl, springs) { + eachProp(springs, (spring, key) => { + if (!ctrl.springs[key]) { + ctrl.springs[key] = spring; + addFluidObserver(spring, ctrl); + } + }); +} + +function createSpring(key, observer) { + const spring = new SpringValue(); + spring.key = key; + + if (observer) { + addFluidObserver(spring, observer); + } + + return spring; +} + +function prepareSprings(springs, props, create) { + if (props.keys) { + react_spring_shared_esm_each(props.keys, key => { + const spring = springs[key] || (springs[key] = create(key)); + spring['_prepareNode'](props); + }); + } +} + +function prepareKeys(ctrl, queue) { + react_spring_shared_esm_each(queue, props => { + prepareSprings(ctrl.springs, props, key => { + return createSpring(key, ctrl); + }); + }); +} + +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; +} + +const _excluded$3 = ["children"]; +const SpringContext = _ref => { + let { + children + } = _ref, + props = _objectWithoutPropertiesLoose(_ref, _excluded$3); + + const inherited = (0,external_React_.useContext)(ctx); + const pause = props.pause || !!inherited.pause, + immediate = props.immediate || !!inherited.immediate; + props = useMemoOne(() => ({ + pause, + immediate + }), [pause, immediate]); + const { + Provider + } = ctx; + return external_React_.createElement(Provider, { + value: props + }, children); +}; +const ctx = makeContext(SpringContext, {}); +SpringContext.Provider = ctx.Provider; +SpringContext.Consumer = ctx.Consumer; + +function makeContext(target, init) { + Object.assign(target, external_React_.createContext(init)); + target.Provider._context = target; + target.Consumer._context = target; + return target; +} + +const SpringRef = () => { + const current = []; + + const SpringRef = function SpringRef(props) { + deprecateDirectCall(); + const results = []; + react_spring_shared_esm_each(current, (ctrl, i) => { + if (react_spring_shared_esm_is.und(props)) { + results.push(ctrl.start()); + } else { + const update = _getProps(props, ctrl, i); + + if (update) { + results.push(ctrl.start(update)); + } + } + }); + return results; + }; + + SpringRef.current = current; + + SpringRef.add = function (ctrl) { + if (!current.includes(ctrl)) { + current.push(ctrl); + } + }; + + SpringRef.delete = function (ctrl) { + const i = current.indexOf(ctrl); + if (~i) current.splice(i, 1); + }; + + SpringRef.pause = function () { + react_spring_shared_esm_each(current, ctrl => ctrl.pause(...arguments)); + return this; + }; + + SpringRef.resume = function () { + react_spring_shared_esm_each(current, ctrl => ctrl.resume(...arguments)); + return this; + }; + + SpringRef.set = function (values) { + react_spring_shared_esm_each(current, ctrl => ctrl.set(values)); + }; + + SpringRef.start = function (props) { + const results = []; + react_spring_shared_esm_each(current, (ctrl, i) => { + if (react_spring_shared_esm_is.und(props)) { + results.push(ctrl.start()); + } else { + const update = this._getProps(props, ctrl, i); + + if (update) { + results.push(ctrl.start(update)); + } + } + }); + return results; + }; + + SpringRef.stop = function () { + react_spring_shared_esm_each(current, ctrl => ctrl.stop(...arguments)); + return this; + }; + + SpringRef.update = function (props) { + react_spring_shared_esm_each(current, (ctrl, i) => ctrl.update(this._getProps(props, ctrl, i))); + return this; + }; + + const _getProps = function _getProps(arg, ctrl, index) { + return react_spring_shared_esm_is.fun(arg) ? arg(index, ctrl) : arg; + }; + + SpringRef._getProps = _getProps; + return SpringRef; +}; + +function useSprings(length, props, deps) { + const propsFn = react_spring_shared_esm_is.fun(props) && props; + if (propsFn && !deps) deps = []; + const ref = (0,external_React_.useMemo)(() => propsFn || arguments.length == 3 ? SpringRef() : void 0, []); + const layoutId = (0,external_React_.useRef)(0); + const forceUpdate = react_spring_shared_esm_useForceUpdate(); + const state = (0,external_React_.useMemo)(() => ({ + ctrls: [], + queue: [], + + flush(ctrl, updates) { + const springs = getSprings(ctrl, updates); + const canFlushSync = layoutId.current > 0 && !state.queue.length && !Object.keys(springs).some(key => !ctrl.springs[key]); + return canFlushSync ? flushUpdateQueue(ctrl, updates) : new Promise(resolve => { + setSprings(ctrl, springs); + state.queue.push(() => { + resolve(flushUpdateQueue(ctrl, updates)); + }); + forceUpdate(); + }); + } + + }), []); + const ctrls = (0,external_React_.useRef)([...state.ctrls]); + const updates = []; + const prevLength = react_spring_shared_esm_usePrev(length) || 0; + (0,external_React_.useMemo)(() => { + react_spring_shared_esm_each(ctrls.current.slice(length, prevLength), ctrl => { + detachRefs(ctrl, ref); + ctrl.stop(true); + }); + ctrls.current.length = length; + declareUpdates(prevLength, length); + }, [length]); + (0,external_React_.useMemo)(() => { + declareUpdates(0, Math.min(prevLength, length)); + }, deps); + + function declareUpdates(startIndex, endIndex) { + for (let i = startIndex; i < endIndex; i++) { + const ctrl = ctrls.current[i] || (ctrls.current[i] = new Controller(null, state.flush)); + const update = propsFn ? propsFn(i, ctrl) : props[i]; + + if (update) { + updates[i] = declareUpdate(update); + } + } + } + + const springs = ctrls.current.map((ctrl, i) => getSprings(ctrl, updates[i])); + const context = (0,external_React_.useContext)(SpringContext); + const prevContext = react_spring_shared_esm_usePrev(context); + const hasContext = context !== prevContext && hasProps(context); + react_spring_shared_esm_useIsomorphicLayoutEffect(() => { + layoutId.current++; + state.ctrls = ctrls.current; + const { + queue + } = state; + + if (queue.length) { + state.queue = []; + react_spring_shared_esm_each(queue, cb => cb()); + } + + react_spring_shared_esm_each(ctrls.current, (ctrl, i) => { + ref == null ? void 0 : ref.add(ctrl); + + if (hasContext) { + ctrl.start({ + default: context + }); + } + + const update = updates[i]; + + if (update) { + replaceRef(ctrl, update.ref); + + if (ctrl.ref) { + ctrl.queue.push(update); + } else { + ctrl.start(update); + } + } + }); + }); + react_spring_shared_esm_useOnce(() => () => { + react_spring_shared_esm_each(state.ctrls, ctrl => ctrl.stop(true)); + }); + const values = springs.map(x => react_spring_core_esm_extends({}, x)); + return ref ? [values, ref] : values; +} + +function useSpring(props, deps) { + const isFn = react_spring_shared_esm_is.fun(props); + const [[values], ref] = useSprings(1, isFn ? props : [props], isFn ? deps || [] : deps); + return isFn || arguments.length == 2 ? [values, ref] : values; +} + +const initSpringRef = () => SpringRef(); + +const useSpringRef = () => useState(initSpringRef)[0]; + +function useTrail(length, propsArg, deps) { + var _passedRef; + + const propsFn = is.fun(propsArg) && propsArg; + if (propsFn && !deps) deps = []; + let reverse = true; + let passedRef = undefined; + const result = useSprings(length, (i, ctrl) => { + const props = propsFn ? propsFn(i, ctrl) : propsArg; + passedRef = props.ref; + reverse = reverse && props.reverse; + return props; + }, deps || [{}]); + const ref = (_passedRef = passedRef) != null ? _passedRef : result[1]; + useIsomorphicLayoutEffect(() => { + each(ref.current, (ctrl, i) => { + const parent = ref.current[i + (reverse ? 1 : -1)]; + + if (parent) { + ctrl.start({ + to: parent.springs + }); + } else { + ctrl.start(); + } + }); + }, deps); + + if (propsFn || arguments.length == 3) { + ref['_getProps'] = (propsArg, ctrl, i) => { + const props = is.fun(propsArg) ? propsArg(i, ctrl) : propsArg; + + if (props) { + const parent = ref.current[i + (props.reverse ? 1 : -1)]; + if (parent) props.to = parent.springs; + return props; + } + }; + + return result; + } + + ref['start'] = propsArg => { + const results = []; + each(ref.current, (ctrl, i) => { + const props = is.fun(propsArg) ? propsArg(i, ctrl) : propsArg; + const parent = ref.current[i + (reverse ? 1 : -1)]; + + if (parent) { + results.push(ctrl.start(react_spring_core_esm_extends({}, props, { + to: parent.springs + }))); + } else { + results.push(ctrl.start(react_spring_core_esm_extends({}, props))); + } + }); + return results; + }; + + return result[0]; +} + +let TransitionPhase; + +(function (TransitionPhase) { + TransitionPhase["MOUNT"] = "mount"; + TransitionPhase["ENTER"] = "enter"; + TransitionPhase["UPDATE"] = "update"; + TransitionPhase["LEAVE"] = "leave"; +})(TransitionPhase || (TransitionPhase = {})); + +function useTransition(data, props, deps) { + const propsFn = is.fun(props) && props; + const { + reset, + sort, + trail = 0, + expires = true, + exitBeforeEnter = false, + onDestroyed, + ref: propsRef, + config: propsConfig + } = propsFn ? propsFn() : props; + const ref = useMemo(() => propsFn || arguments.length == 3 ? SpringRef() : void 0, []); + const items = toArray(data); + const transitions = []; + const usedTransitions = useRef(null); + const prevTransitions = reset ? null : usedTransitions.current; + useIsomorphicLayoutEffect(() => { + usedTransitions.current = transitions; + }); + useOnce(() => { + each(transitions, t => { + ref == null ? void 0 : ref.add(t.ctrl); + t.ctrl.ref = ref; + }); + return () => { + each(usedTransitions.current, t => { + if (t.expired) { + clearTimeout(t.expirationId); + } + + detachRefs(t.ctrl, ref); + t.ctrl.stop(true); + }); + }; + }); + const keys = getKeys(items, propsFn ? propsFn() : props, prevTransitions); + const expired = reset && usedTransitions.current || []; + useIsomorphicLayoutEffect(() => each(expired, ({ + ctrl, + item, + key + }) => { + detachRefs(ctrl, ref); + callProp(onDestroyed, item, key); + })); + const reused = []; + if (prevTransitions) each(prevTransitions, (t, i) => { + if (t.expired) { + clearTimeout(t.expirationId); + expired.push(t); + } else { + i = reused[i] = keys.indexOf(t.key); + if (~i) transitions[i] = t; + } + }); + each(items, (item, i) => { + if (!transitions[i]) { + transitions[i] = { + key: keys[i], + item, + phase: TransitionPhase.MOUNT, + ctrl: new Controller() + }; + transitions[i].ctrl.item = item; + } + }); + + if (reused.length) { + let i = -1; + const { + leave + } = propsFn ? propsFn() : props; + each(reused, (keyIndex, prevIndex) => { + const t = prevTransitions[prevIndex]; + + if (~keyIndex) { + i = transitions.indexOf(t); + transitions[i] = react_spring_core_esm_extends({}, t, { + item: items[keyIndex] + }); + } else if (leave) { + transitions.splice(++i, 0, t); + } + }); + } + + if (is.fun(sort)) { + transitions.sort((a, b) => sort(a.item, b.item)); + } + + let delay = -trail; + const forceUpdate = useForceUpdate(); + const defaultProps = getDefaultProps(props); + const changes = new Map(); + const exitingTransitions = useRef(new Map()); + const forceChange = useRef(false); + each(transitions, (t, i) => { + const key = t.key; + const prevPhase = t.phase; + const p = propsFn ? propsFn() : props; + let to; + let phase; + let propsDelay = callProp(p.delay || 0, key); + + if (prevPhase == TransitionPhase.MOUNT) { + to = p.enter; + phase = TransitionPhase.ENTER; + } else { + const isLeave = keys.indexOf(key) < 0; + + if (prevPhase != TransitionPhase.LEAVE) { + if (isLeave) { + to = p.leave; + phase = TransitionPhase.LEAVE; + } else if (to = p.update) { + phase = TransitionPhase.UPDATE; + } else return; + } else if (!isLeave) { + to = p.enter; + phase = TransitionPhase.ENTER; + } else return; + } + + to = callProp(to, t.item, i); + to = is.obj(to) ? inferTo(to) : { + to + }; + + if (!to.config) { + const config = propsConfig || defaultProps.config; + to.config = callProp(config, t.item, i, phase); + } + + delay += trail; + + const payload = react_spring_core_esm_extends({}, defaultProps, { + delay: propsDelay + delay, + ref: propsRef, + immediate: p.immediate, + reset: false + }, to); + + if (phase == TransitionPhase.ENTER && is.und(payload.from)) { + const _p = propsFn ? propsFn() : props; + + const from = is.und(_p.initial) || prevTransitions ? _p.from : _p.initial; + payload.from = callProp(from, t.item, i); + } + + const { + onResolve + } = payload; + + payload.onResolve = result => { + callProp(onResolve, result); + const transitions = usedTransitions.current; + const t = transitions.find(t => t.key === key); + if (!t) return; + + if (result.cancelled && t.phase != TransitionPhase.UPDATE) { + return; + } + + if (t.ctrl.idle) { + const idle = transitions.every(t => t.ctrl.idle); + + if (t.phase == TransitionPhase.LEAVE) { + const expiry = callProp(expires, t.item); + + if (expiry !== false) { + const expiryMs = expiry === true ? 0 : expiry; + t.expired = true; + + if (!idle && expiryMs > 0) { + if (expiryMs <= 0x7fffffff) t.expirationId = setTimeout(forceUpdate, expiryMs); + return; + } + } + } + + if (idle && transitions.some(t => t.expired)) { + exitingTransitions.current.delete(t); + + if (exitBeforeEnter) { + forceChange.current = true; + } + + forceUpdate(); + } + } + }; + + const springs = getSprings(t.ctrl, payload); + + if (phase === TransitionPhase.LEAVE && exitBeforeEnter) { + exitingTransitions.current.set(t, { + phase, + springs, + payload + }); + } else { + changes.set(t, { + phase, + springs, + payload + }); + } + }); + const context = useContext(SpringContext); + const prevContext = usePrev(context); + const hasContext = context !== prevContext && hasProps(context); + useIsomorphicLayoutEffect(() => { + if (hasContext) { + each(transitions, t => { + t.ctrl.start({ + default: context + }); + }); + } + }, [context]); + each(changes, (_, t) => { + if (exitingTransitions.current.size) { + const ind = transitions.findIndex(state => state.key === t.key); + transitions.splice(ind, 1); + } + }); + useIsomorphicLayoutEffect(() => { + each(exitingTransitions.current.size ? exitingTransitions.current : changes, ({ + phase, + payload + }, t) => { + const { + ctrl + } = t; + t.phase = phase; + ref == null ? void 0 : ref.add(ctrl); + + if (hasContext && phase == TransitionPhase.ENTER) { + ctrl.start({ + default: context + }); + } + + if (payload) { + replaceRef(ctrl, payload.ref); + + if ((ctrl.ref || ref) && !forceChange.current) { + ctrl.update(payload); + } else { + ctrl.start(payload); + + if (forceChange.current) { + forceChange.current = false; + } + } + } + }); + }, reset ? void 0 : deps); + + const renderTransitions = render => React.createElement(React.Fragment, null, transitions.map((t, i) => { + const { + springs + } = changes.get(t) || t.ctrl; + const elem = render(react_spring_core_esm_extends({}, springs), t.item, t, i); + return elem && elem.type ? React.createElement(elem.type, react_spring_core_esm_extends({}, elem.props, { + key: is.str(t.key) || is.num(t.key) ? t.key : t.ctrl.id, + ref: elem.ref + })) : elem; + })); + + return ref ? [renderTransitions, ref] : renderTransitions; +} +let nextKey = 1; + +function getKeys(items, { + key, + keys = key +}, prevTransitions) { + if (keys === null) { + const reused = new Set(); + return items.map(item => { + const t = prevTransitions && prevTransitions.find(t => t.item === item && t.phase !== TransitionPhase.LEAVE && !reused.has(t)); + + if (t) { + reused.add(t); + return t.key; + } + + return nextKey++; + }); + } + + return is.und(keys) ? items : is.fun(keys) ? items.map(keys) : toArray(keys); +} + +const _excluded$2 = (/* unused pure expression or super */ null && (["children"])); +function Spring(_ref) { + let { + children + } = _ref, + props = _objectWithoutPropertiesLoose(_ref, _excluded$2); + + return children(useSpring(props)); +} + +const _excluded$1 = (/* unused pure expression or super */ null && (["items", "children"])); +function Trail(_ref) { + let { + items, + children + } = _ref, + props = _objectWithoutPropertiesLoose(_ref, _excluded$1); + + const trails = useTrail(items.length, props); + return items.map((item, index) => { + const result = children(item, index); + return is.fun(result) ? result(trails[index]) : result; + }); +} + +const _excluded = (/* unused pure expression or super */ null && (["items", "children"])); +function Transition(_ref) { + let { + items, + children + } = _ref, + props = _objectWithoutPropertiesLoose(_ref, _excluded); + + return useTransition(items, props)(children); +} + +class Interpolation extends FrameValue { + constructor(source, args) { + super(); + this.key = void 0; + this.idle = true; + this.calc = void 0; + this._active = new Set(); + this.source = source; + this.calc = createInterpolator(...args); + + const value = this._get(); + + const nodeType = getAnimatedType(value); + setAnimated(this, nodeType.create(value)); + } + + advance(_dt) { + const value = this._get(); + + const oldValue = this.get(); + + if (!isEqual(value, oldValue)) { + getAnimated(this).setValue(value); + + this._onChange(value, this.idle); + } + + if (!this.idle && checkIdle(this._active)) { + becomeIdle(this); + } + } + + _get() { + const inputs = react_spring_shared_esm_is.arr(this.source) ? this.source.map(getFluidValue) : react_spring_shared_esm_toArray(getFluidValue(this.source)); + return this.calc(...inputs); + } + + _start() { + if (this.idle && !checkIdle(this._active)) { + this.idle = false; + react_spring_shared_esm_each(getPayload(this), node => { + node.done = false; + }); + + if (globals.skipAnimation) { + raf.batchedUpdates(() => this.advance()); + becomeIdle(this); + } else { + frameLoop.start(this); + } + } + } + + _attach() { + let priority = 1; + react_spring_shared_esm_each(react_spring_shared_esm_toArray(this.source), source => { + if (hasFluidValue(source)) { + addFluidObserver(source, this); + } + + if (isFrameValue(source)) { + if (!source.idle) { + this._active.add(source); + } + + priority = Math.max(priority, source.priority + 1); + } + }); + this.priority = priority; + + this._start(); + } + + _detach() { + react_spring_shared_esm_each(react_spring_shared_esm_toArray(this.source), source => { + if (hasFluidValue(source)) { + removeFluidObserver(source, this); + } + }); + + this._active.clear(); + + becomeIdle(this); + } + + eventObserved(event) { + if (event.type == 'change') { + if (event.idle) { + this.advance(); + } else { + this._active.add(event.parent); + + this._start(); + } + } else if (event.type == 'idle') { + this._active.delete(event.parent); + } else if (event.type == 'priority') { + this.priority = react_spring_shared_esm_toArray(this.source).reduce((highest, parent) => Math.max(highest, (isFrameValue(parent) ? parent.priority : 0) + 1), 0); + } + } + +} + +function isIdle(source) { + return source.idle !== false; +} + +function checkIdle(active) { + return !active.size || Array.from(active).every(isIdle); +} + +function becomeIdle(self) { + if (!self.idle) { + self.idle = true; + react_spring_shared_esm_each(getPayload(self), node => { + node.done = true; + }); + callFluidObservers(self, { + type: 'idle', + parent: self + }); + } +} + +const react_spring_core_esm_to = (source, ...args) => new Interpolation(source, args); +const react_spring_core_esm_interpolate = (source, ...args) => (deprecateInterpolate(), new Interpolation(source, args)); + +globals.assign({ + createStringInterpolator: createStringInterpolator, + to: (source, args) => new Interpolation(source, args) +}); +const react_spring_core_esm_update = frameLoop.advance; + + + +;// CONCATENATED MODULE: external "ReactDOM" +var external_ReactDOM_namespaceObject = window["ReactDOM"]; +;// CONCATENATED MODULE: ./node_modules/@react-spring/web/dist/react-spring-web.esm.js + + + + + + +function react_spring_web_esm_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; +} + +const react_spring_web_esm_excluded$2 = ["style", "children", "scrollTop", "scrollLeft"]; +const isCustomPropRE = /^--/; + +function dangerousStyleValue(name, value) { + if (value == null || typeof value === 'boolean' || value === '') return ''; + if (typeof value === 'number' && value !== 0 && !isCustomPropRE.test(name) && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) return value + 'px'; + return ('' + value).trim(); +} + +const attributeCache = {}; +function applyAnimatedValues(instance, props) { + if (!instance.nodeType || !instance.setAttribute) { + return false; + } + + const isFilterElement = instance.nodeName === 'filter' || instance.parentNode && instance.parentNode.nodeName === 'filter'; + + const _ref = props, + { + style, + children, + scrollTop, + scrollLeft + } = _ref, + attributes = react_spring_web_esm_objectWithoutPropertiesLoose(_ref, react_spring_web_esm_excluded$2); + + const values = Object.values(attributes); + const names = Object.keys(attributes).map(name => isFilterElement || instance.hasAttribute(name) ? name : attributeCache[name] || (attributeCache[name] = name.replace(/([A-Z])/g, n => '-' + n.toLowerCase()))); + + if (children !== void 0) { + instance.textContent = children; + } + + for (let name in style) { + if (style.hasOwnProperty(name)) { + const value = dangerousStyleValue(name, style[name]); + + if (isCustomPropRE.test(name)) { + instance.style.setProperty(name, value); + } else { + instance.style[name] = value; + } + } + } + + names.forEach((name, i) => { + instance.setAttribute(name, values[i]); + }); + + if (scrollTop !== void 0) { + instance.scrollTop = scrollTop; + } + + if (scrollLeft !== void 0) { + instance.scrollLeft = scrollLeft; + } +} +let isUnitlessNumber = { + animationIterationCount: true, + borderImageOutset: true, + borderImageSlice: true, + borderImageWidth: true, + boxFlex: true, + boxFlexGroup: true, + boxOrdinalGroup: true, + columnCount: true, + columns: true, + flex: true, + flexGrow: true, + flexPositive: true, + flexShrink: true, + flexNegative: true, + flexOrder: true, + gridRow: true, + gridRowEnd: true, + gridRowSpan: true, + gridRowStart: true, + gridColumn: true, + gridColumnEnd: true, + gridColumnSpan: true, + gridColumnStart: true, + fontWeight: true, + lineClamp: true, + lineHeight: true, + opacity: true, + order: true, + orphans: true, + tabSize: true, + widows: true, + zIndex: true, + zoom: true, + fillOpacity: true, + floodOpacity: true, + stopOpacity: true, + strokeDasharray: true, + strokeDashoffset: true, + strokeMiterlimit: true, + strokeOpacity: true, + strokeWidth: true +}; + +const prefixKey = (prefix, key) => prefix + key.charAt(0).toUpperCase() + key.substring(1); + +const prefixes = ['Webkit', 'Ms', 'Moz', 'O']; +isUnitlessNumber = Object.keys(isUnitlessNumber).reduce((acc, prop) => { + prefixes.forEach(prefix => acc[prefixKey(prefix, prop)] = acc[prop]); + return acc; +}, isUnitlessNumber); + +const react_spring_web_esm_excluded$1 = ["x", "y", "z"]; +const domTransforms = /^(matrix|translate|scale|rotate|skew)/; +const pxTransforms = /^(translate)/; +const degTransforms = /^(rotate|skew)/; + +const addUnit = (value, unit) => react_spring_shared_esm_is.num(value) && value !== 0 ? value + unit : value; + +const isValueIdentity = (value, id) => react_spring_shared_esm_is.arr(value) ? value.every(v => isValueIdentity(v, id)) : react_spring_shared_esm_is.num(value) ? value === id : parseFloat(value) === id; + +class AnimatedStyle extends AnimatedObject { + constructor(_ref) { + let { + x, + y, + z + } = _ref, + style = react_spring_web_esm_objectWithoutPropertiesLoose(_ref, react_spring_web_esm_excluded$1); + + const inputs = []; + const transforms = []; + + if (x || y || z) { + inputs.push([x || 0, y || 0, z || 0]); + transforms.push(xyz => [`translate3d(${xyz.map(v => addUnit(v, 'px')).join(',')})`, isValueIdentity(xyz, 0)]); + } + + eachProp(style, (value, key) => { + if (key === 'transform') { + inputs.push([value || '']); + transforms.push(transform => [transform, transform === '']); + } else if (domTransforms.test(key)) { + delete style[key]; + if (react_spring_shared_esm_is.und(value)) return; + const unit = pxTransforms.test(key) ? 'px' : degTransforms.test(key) ? 'deg' : ''; + inputs.push(react_spring_shared_esm_toArray(value)); + transforms.push(key === 'rotate3d' ? ([x, y, z, deg]) => [`rotate3d(${x},${y},${z},${addUnit(deg, unit)})`, isValueIdentity(deg, 0)] : input => [`${key}(${input.map(v => addUnit(v, unit)).join(',')})`, isValueIdentity(input, key.startsWith('scale') ? 1 : 0)]); + } + }); + + if (inputs.length) { + style.transform = new FluidTransform(inputs, transforms); + } + + super(style); + } + +} + +class FluidTransform extends FluidValue { + constructor(inputs, transforms) { + super(); + this._value = null; + this.inputs = inputs; + this.transforms = transforms; + } + + get() { + return this._value || (this._value = this._get()); + } + + _get() { + let transform = ''; + let identity = true; + react_spring_shared_esm_each(this.inputs, (input, i) => { + const arg1 = getFluidValue(input[0]); + const [t, id] = this.transforms[i](react_spring_shared_esm_is.arr(arg1) ? arg1 : input.map(getFluidValue)); + transform += ' ' + t; + identity = identity && id; + }); + return identity ? 'none' : transform; + } + + observerAdded(count) { + if (count == 1) react_spring_shared_esm_each(this.inputs, input => react_spring_shared_esm_each(input, value => hasFluidValue(value) && addFluidObserver(value, this))); + } + + observerRemoved(count) { + if (count == 0) react_spring_shared_esm_each(this.inputs, input => react_spring_shared_esm_each(input, value => hasFluidValue(value) && removeFluidObserver(value, this))); + } + + eventObserved(event) { + if (event.type == 'change') { + this._value = null; + } + + callFluidObservers(this, event); + } + +} + +const primitives = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', 'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan']; + +const react_spring_web_esm_excluded = ["scrollTop", "scrollLeft"]; +globals.assign({ + batchedUpdates: external_ReactDOM_namespaceObject.unstable_batchedUpdates, + createStringInterpolator: createStringInterpolator, + colors: colors +}); +const host = createHost(primitives, { + applyAnimatedValues, + createAnimatedStyle: style => new AnimatedStyle(style), + getComponentProps: _ref => { + let props = react_spring_web_esm_objectWithoutPropertiesLoose(_ref, react_spring_web_esm_excluded); + + return props; + } +}); +const animated = host.animated; + + + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-moving-animation/index.js /** * External dependencies */ @@ -19581,7 +17663,7 @@ /** * Simple reducer used to increment a counter. * - * @param {number} state Previous counter value. + * @param {number} state Previous counter value. * @return {number} New state value. */ @@ -19612,29 +17694,30 @@ */ -function useMovingAnimation({ - isSelected, - adjustScrolling, - enableAnimation, - triggerAnimationOnChange -}) { - const ref = Object(external_wp_element_["useRef"])(); - const prefersReducedMotion = Object(external_wp_compose_["useReducedMotion"])() || !enableAnimation; - const [triggeredAnimation, triggerAnimation] = Object(external_wp_element_["useReducer"])(counterReducer, 0); - const [finishedAnimation, endAnimation] = Object(external_wp_element_["useReducer"])(counterReducer, 0); - const [transform, setTransform] = Object(external_wp_element_["useState"])({ +function useMovingAnimation(_ref) { + let { + isSelected, + adjustScrolling, + enableAnimation, + triggerAnimationOnChange + } = _ref; + const ref = (0,external_wp_element_namespaceObject.useRef)(); + const prefersReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)() || !enableAnimation; + const [triggeredAnimation, triggerAnimation] = (0,external_wp_element_namespaceObject.useReducer)(counterReducer, 0); + const [finishedAnimation, endAnimation] = (0,external_wp_element_namespaceObject.useReducer)(counterReducer, 0); + const [transform, setTransform] = (0,external_wp_element_namespaceObject.useState)({ x: 0, y: 0 }); - const previous = Object(external_wp_element_["useMemo"])(() => ref.current ? getAbsolutePosition(ref.current) : null, [triggerAnimationOnChange]); // Calculate the previous position of the block relative to the viewport and + const previous = (0,external_wp_element_namespaceObject.useMemo)(() => ref.current ? getAbsolutePosition(ref.current) : null, [triggerAnimationOnChange]); // Calculate the previous position of the block relative to the viewport and // return a function to maintain that position by scrolling. - const preserveScrollPosition = Object(external_wp_element_["useMemo"])(() => { + const preserveScrollPosition = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!adjustScrolling || !ref.current) { return () => {}; } - const scrollContainer = Object(external_wp_dom_["getScrollContainer"])(ref.current); + const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(ref.current); if (!scrollContainer) { return () => {}; @@ -19650,18 +17733,18 @@ } }; }, [triggerAnimationOnChange, adjustScrolling]); - Object(external_wp_element_["useLayoutEffect"])(() => { + (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (triggeredAnimation) { endAnimation(); } }, [triggeredAnimation]); - Object(external_wp_element_["useLayoutEffect"])(() => { + (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!previous) { return; } if (prefersReducedMotion) { - // if the animation is disabled and the scroll needs to be adjusted, + // If the animation is disabled and the scroll needs to be adjusted, // just move directly to the final scroll position. preserveScrollPosition(); return; @@ -19676,10 +17759,12 @@ }); }, [triggerAnimationOnChange]); // Only called when either the x or y value changes. - function onFrameChange({ - x, - y - }) { + function onFrameChange(_ref2) { + let { + x, + y + } = _ref2; + if (!ref.current) { return; } @@ -19692,26 +17777,30 @@ } // Called for every frame computed by useSpring. - function onFrame({ - x, - y - }) { + function onChange(_ref3) { + let { + value + } = _ref3; + let { + x, + y + } = value; x = Math.round(x); y = Math.round(y); - if (x !== onFrame.x || y !== onFrame.y) { + if (x !== onChange.x || y !== onChange.y) { onFrameChange({ x, y }); - onFrame.x = x; - onFrame.y = y; - } - } - - onFrame.x = 0; - onFrame.y = 0; - Object(web_cjs["useSpring"])({ + onChange.x = x; + onChange.y = y; + } + } + + onChange.x = 0; + onChange.y = 0; + useSpring({ from: { x: transform.x, y: transform.y @@ -19727,809 +17816,17 @@ friction: 200 }, immediate: prefersReducedMotion, - onFrame + onChange }); return ref; } /* harmony default export */ var use_moving_animation = (useMovingAnimation); -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/leaf.js - - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -const AnimatedTreeGridRow = Object(web_cjs["animated"])(external_wp_components_["__experimentalTreeGridRow"]); -function BlockNavigationLeaf({ - isSelected, - position, - level, - rowCount, - children, - className, - path, - ...props -}) { - const ref = use_moving_animation({ - isSelected, - adjustScrolling: false, - enableAnimation: true, - triggerAnimationOnChange: path.join('_') - }); - return Object(external_wp_element_["createElement"])(AnimatedTreeGridRow, Object(esm_extends["a" /* default */])({ - ref: ref, - className: classnames_default()('block-editor-block-navigation-leaf', className), - level: level, - positionInSet: position, - setSize: rowCount - }, props), children); -} - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js -var chevron_right = __webpack_require__("1iEr"); - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js -var chevron_left = __webpack_require__("2gm7"); - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-up.js -var chevron_up = __webpack_require__("XgzB"); - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js -var chevron_down = __webpack_require__("NWDH"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-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). - * @param {string} orientation The orientation of the block movers, vertical or - * horizontal. - * - * @return {string} Label for the block movement controls. - */ - -function getBlockMoverDescription(selectedCount, type, firstIndex, isFirst, isLast, dir, orientation) { - const position = firstIndex + 1; - - const getMovementDirection = moveDirection => { - if (moveDirection === 'up') { - if (orientation === 'horizontal') { - return Object(external_wp_i18n_["isRTL"])() ? 'right' : 'left'; - } - - return 'up'; - } else if (moveDirection === 'down') { - if (orientation === 'horizontal') { - return Object(external_wp_i18n_["isRTL"])() ? 'left' : 'right'; - } - - return 'down'; - } - - return null; - }; - - if (selectedCount > 1) { - return getMultiBlockMoverDescription(selectedCount, firstIndex, isFirst, isLast, dir); - } - - if (isFirst && isLast) { - return Object(external_wp_i18n_["sprintf"])( // translators: %s: Type of block (i.e. Text, Image etc) - Object(external_wp_i18n_["__"])('Block %s is the only block, and cannot be moved'), type); - } - - if (dir > 0 && !isLast) { - // moving down - const movementDirection = getMovementDirection('down'); - - if (movementDirection === 'down') { - return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position - Object(external_wp_i18n_["__"])('Move %1$s block from position %2$d down to position %3$d'), type, position, position + 1); - } - - if (movementDirection === 'left') { - return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position - Object(external_wp_i18n_["__"])('Move %1$s block from position %2$d left to position %3$d'), type, position, position + 1); - } - - if (movementDirection === 'right') { - return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position - Object(external_wp_i18n_["__"])('Move %1$s block from position %2$d right to position %3$d'), type, position, position + 1); - } - } - - if (dir > 0 && isLast) { - // moving down, and is the last item - const movementDirection = getMovementDirection('down'); - - if (movementDirection === 'down') { - return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc) - Object(external_wp_i18n_["__"])('Block %1$s is at the end of the content and can’t be moved down'), type); - } - - if (movementDirection === 'left') { - return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc) - Object(external_wp_i18n_["__"])('Block %1$s is at the end of the content and can’t be moved left'), type); - } - - if (movementDirection === 'right') { - return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc) - Object(external_wp_i18n_["__"])('Block %1$s is at the end of the content and can’t be moved right'), type); - } - } - - if (dir < 0 && !isFirst) { - // moving up - const movementDirection = getMovementDirection('up'); - - if (movementDirection === 'up') { - return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position - Object(external_wp_i18n_["__"])('Move %1$s block from position %2$d up to position %3$d'), type, position, position - 1); - } - - if (movementDirection === 'left') { - return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position - Object(external_wp_i18n_["__"])('Move %1$s block from position %2$d left to position %3$d'), type, position, position - 1); - } - - if (movementDirection === 'right') { - return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position - Object(external_wp_i18n_["__"])('Move %1$s block from position %2$d right to position %3$d'), type, position, position - 1); - } - } - - if (dir < 0 && isFirst) { - // moving up, and is the first item - const movementDirection = getMovementDirection('up'); - - if (movementDirection === 'up') { - return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc) - Object(external_wp_i18n_["__"])('Block %1$s is at the beginning of the content and can’t be moved up'), type); - } - - if (movementDirection === 'left') { - return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc) - Object(external_wp_i18n_["__"])('Block %1$s is at the beginning of the content and can’t be moved left'), type); - } - - if (movementDirection === 'right') { - return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc) - Object(external_wp_i18n_["__"])('Block %1$s is at the beginning of the content and can’t be moved right'), 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) { - const position = firstIndex + 1; - - if (dir < 0 && isFirst) { - return Object(external_wp_i18n_["__"])('Blocks cannot be moved up as they are already at the top'); - } - - if (dir > 0 && isLast) { - return Object(external_wp_i18n_["__"])('Blocks cannot be moved down as they are already at the bottom'); - } - - if (dir < 0 && !isFirst) { - return Object(external_wp_i18n_["sprintf"])( // translators: 1: Number of selected blocks, 2: Position of selected blocks - Object(external_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_wp_i18n_["sprintf"])( // translators: 1: Number of selected blocks, 2: Position of selected blocks - Object(external_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/block-editor/build-module/components/block-mover/button.js - - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - - - - -/** - * Internal dependencies - */ - - - - - -const getArrowIcon = (direction, orientation) => { - if (direction === 'up') { - if (orientation === 'horizontal') { - return Object(external_wp_i18n_["isRTL"])() ? chevron_right["a" /* default */] : chevron_left["a" /* default */]; - } - - return chevron_up["a" /* default */]; - } else if (direction === 'down') { - if (orientation === 'horizontal') { - return Object(external_wp_i18n_["isRTL"])() ? chevron_left["a" /* default */] : chevron_right["a" /* default */]; - } - - return chevron_down["a" /* default */]; - } - - return null; -}; - -const getMovementDirectionLabel = (moveDirection, orientation) => { - if (moveDirection === 'up') { - if (orientation === 'horizontal') { - return Object(external_wp_i18n_["isRTL"])() ? Object(external_wp_i18n_["__"])('Move right') : Object(external_wp_i18n_["__"])('Move left'); - } - - return Object(external_wp_i18n_["__"])('Move up'); - } else if (moveDirection === 'down') { - if (orientation === 'horizontal') { - return Object(external_wp_i18n_["isRTL"])() ? Object(external_wp_i18n_["__"])('Move left') : Object(external_wp_i18n_["__"])('Move right'); - } - - return Object(external_wp_i18n_["__"])('Move down'); - } - - return null; -}; - -const BlockMoverButton = Object(external_wp_element_["forwardRef"])(({ - clientIds, - direction, - orientation: moverOrientation, - ...props -}, ref) => { - const instanceId = Object(external_wp_compose_["useInstanceId"])(BlockMoverButton); - const blocksCount = Object(external_lodash_["castArray"])(clientIds).length; - const { - blockType, - isDisabled, - rootClientId, - isFirst, - isLast, - firstIndex, - orientation = 'vertical' - } = Object(external_wp_data_["useSelect"])(select => { - const { - getBlockIndex, - getBlockRootClientId, - getBlockOrder, - getBlock, - getBlockListSettings - } = select(store); - const normalizedClientIds = Object(external_lodash_["castArray"])(clientIds); - const firstClientId = Object(external_lodash_["first"])(normalizedClientIds); - const blockRootClientId = getBlockRootClientId(firstClientId); - const firstBlockIndex = getBlockIndex(firstClientId, blockRootClientId); - const lastBlockIndex = getBlockIndex(Object(external_lodash_["last"])(normalizedClientIds), blockRootClientId); - const blockOrder = getBlockOrder(blockRootClientId); - const block = getBlock(firstClientId); - const isFirstBlock = firstBlockIndex === 0; - const isLastBlock = lastBlockIndex === blockOrder.length - 1; - const { - orientation: blockListOrientation - } = getBlockListSettings(blockRootClientId) || {}; - return { - blockType: block ? Object(external_wp_blocks_["getBlockType"])(block.name) : null, - isDisabled: direction === 'up' ? isFirstBlock : isLastBlock, - rootClientId: blockRootClientId, - firstIndex: firstBlockIndex, - isFirst: isFirstBlock, - isLast: isLastBlock, - orientation: moverOrientation || blockListOrientation - }; - }, [clientIds, direction]); - const { - moveBlocksDown, - moveBlocksUp - } = Object(external_wp_data_["useDispatch"])(store); - const moverFunction = direction === 'up' ? moveBlocksUp : moveBlocksDown; - - const onClick = event => { - moverFunction(clientIds, rootClientId); - - if (props.onClick) { - props.onClick(event); - } - }; - - const descriptionId = `block-editor-block-mover-button__description-${instanceId}`; - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({ - ref: ref, - className: classnames_default()('block-editor-block-mover-button', `is-${direction}-button`), - icon: getArrowIcon(direction, orientation), - label: getMovementDirectionLabel(direction, orientation), - "aria-describedby": descriptionId - }, props, { - onClick: isDisabled ? null : onClick, - "aria-disabled": isDisabled - })), Object(external_wp_element_["createElement"])("span", { - id: descriptionId, - className: "block-editor-block-mover-button__description" - }, getBlockMoverDescription(blocksCount, blockType && blockType.title, firstIndex, isFirst, isLast, direction === 'up' ? -1 : 1, orientation))); -}); -const BlockMoverUpButton = Object(external_wp_element_["forwardRef"])((props, ref) => { - return Object(external_wp_element_["createElement"])(BlockMoverButton, Object(esm_extends["a" /* default */])({ - direction: "up", - ref: ref - }, props)); -}); -const BlockMoverDownButton = Object(external_wp_element_["forwardRef"])((props, ref) => { - return Object(external_wp_element_["createElement"])(BlockMoverButton, Object(esm_extends["a" /* default */])({ - direction: "down", - ref: ref - }, props)); -}); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/context.js -/** - * WordPress dependencies - */ - -const BlockNavigationContext = Object(external_wp_element_["createContext"])({ - __experimentalFeatures: false, - __experimentalPersistentListViewFeatures: false -}); -const useBlockNavigationContext = () => Object(external_wp_element_["useContext"])(BlockNavigationContext); - -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-horizontal.js - - -/** - * WordPress dependencies - */ - -const moreHorizontal = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { - d: "M11 13h2v-2h-2v2zm-6 0h2v-2H5v2zm12-2v2h2v-2h-2z" -})); -/* harmony default export */ var more_horizontal = (moreHorizontal); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/warning/index.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - -function Warning({ - className, - actions, - children, - secondaryActions -}) { - return Object(external_wp_element_["createElement"])("div", { - className: classnames_default()(className, 'block-editor-warning') - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-warning__contents" - }, Object(external_wp_element_["createElement"])("p", { - className: "block-editor-warning__message" - }, children), (external_wp_element_["Children"].count(actions) > 0 || secondaryActions) && Object(external_wp_element_["createElement"])("div", { - className: "block-editor-warning__actions" - }, external_wp_element_["Children"].count(actions) > 0 && external_wp_element_["Children"].map(actions, (action, i) => Object(external_wp_element_["createElement"])("span", { - key: i, - className: "block-editor-warning__action" - }, action)), secondaryActions && Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], { - className: "block-editor-warning__secondary", - icon: more_horizontal, - label: Object(external_wp_i18n_["__"])('More options'), - popoverProps: { - position: 'bottom left', - className: 'block-editor-warning__dropdown' - }, - noIcons: true - }, () => Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], null, secondaryActions.map((item, pos) => Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { - onClick: item.onClick, - key: pos - }, item.title))))))); -} -/** - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/warning/README.md - */ - - -/* harmony default export */ var warning = (Warning); - -// EXTERNAL MODULE: ./node_modules/diff/lib/diff/character.js -var diff_character = __webpack_require__("iA5R"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-compare/block-view.js - - -/** - * WordPress dependencies - */ - - - -function BlockView({ - title, - rawContent, - renderedContent, - action, - actionText, - className -}) { - return Object(external_wp_element_["createElement"])("div", { - className: className - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-compare__content" - }, Object(external_wp_element_["createElement"])("h2", { - className: "block-editor-block-compare__heading" - }, title), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-compare__html" - }, rawContent), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-compare__preview edit-post-visual-editor" - }, Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, Object(external_wp_dom_["safeHTML"])(renderedContent)))), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-compare__action" - }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - isSecondary: true, - tabIndex: "0", - onClick: action - }, actionText))); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-compare/index.js - - -/** - * External dependencies - */ - - // diff doesn't tree-shake correctly, so we import from the individual -// module here, to avoid including too much of the library - - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - -function BlockCompare({ - block, - onKeep, - onConvert, - convertor, - convertButtonText -}) { - function getDifference(originalContent, newContent) { - const difference = Object(diff_character["diffChars"])(originalContent, newContent); - return difference.map((item, pos) => { - const classes = classnames_default()({ - 'block-editor-block-compare__added': item.added, - 'block-editor-block-compare__removed': item.removed - }); - return Object(external_wp_element_["createElement"])("span", { - key: pos, - className: classes - }, item.value); - }); - } - - function getConvertedContent(convertedBlock) { - // The convertor may return an array of items or a single item - const newBlocks = Object(external_lodash_["castArray"])(convertedBlock); // Get converted block details - - const newContent = newBlocks.map(item => Object(external_wp_blocks_["getSaveContent"])(item.name, item.attributes, item.innerBlocks)); - return newContent.join(''); - } - - const converted = getConvertedContent(convertor(block)); - const difference = getDifference(block.originalContent, converted); - return Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-compare__wrapper" - }, Object(external_wp_element_["createElement"])(BlockView, { - title: Object(external_wp_i18n_["__"])('Current'), - className: "block-editor-block-compare__current", - action: onKeep, - actionText: Object(external_wp_i18n_["__"])('Convert to HTML'), - rawContent: block.originalContent, - renderedContent: block.originalContent - }), Object(external_wp_element_["createElement"])(BlockView, { - title: Object(external_wp_i18n_["__"])('After Conversion'), - className: "block-editor-block-compare__converted", - action: onConvert, - actionText: convertButtonText, - rawContent: difference, - renderedContent: converted - })); -} - -/* harmony default export */ var block_compare = (BlockCompare); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-invalid-warning.js - - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - - -function BlockInvalidWarning({ - convertToHTML, - convertToBlocks, - convertToClassic, - attemptBlockRecovery, - block -}) { - const hasHTMLBlock = !!Object(external_wp_blocks_["getBlockType"])('core/html'); - const [compare, setCompare] = Object(external_wp_element_["useState"])(false); - const onCompare = Object(external_wp_element_["useCallback"])(() => setCompare(true), []); - const onCompareClose = Object(external_wp_element_["useCallback"])(() => setCompare(false), []); // We memo the array here to prevent the children components from being updated unexpectedly - - const hiddenActions = Object(external_wp_element_["useMemo"])(() => [{ - // translators: Button to fix block content - title: Object(external_wp_i18n_["_x"])('Resolve', 'imperative verb'), - onClick: onCompare - }, hasHTMLBlock && { - title: Object(external_wp_i18n_["__"])('Convert to HTML'), - onClick: convertToHTML - }, { - title: Object(external_wp_i18n_["__"])('Convert to Classic Block'), - onClick: convertToClassic - }].filter(Boolean), [onCompare, convertToHTML, convertToClassic]); - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(warning, { - actions: [Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - key: "recover", - onClick: attemptBlockRecovery, - isPrimary: true - }, Object(external_wp_i18n_["__"])('Attempt Block Recovery'))], - secondaryActions: hiddenActions - }, Object(external_wp_i18n_["__"])('This block contains unexpected or invalid content.')), compare && Object(external_wp_element_["createElement"])(external_wp_components_["Modal"], { - title: // translators: Dialog title to fix block content - Object(external_wp_i18n_["__"])('Resolve Block'), - onRequestClose: onCompareClose, - className: "block-editor-block-compare" - }, Object(external_wp_element_["createElement"])(block_compare, { - block: block, - onKeep: convertToHTML, - onConvert: convertToBlocks, - convertor: blockToBlocks, - convertButtonText: Object(external_wp_i18n_["__"])('Convert to Blocks') - }))); -} - -const blockToClassic = block => Object(external_wp_blocks_["createBlock"])('core/freeform', { - content: block.originalContent -}); - -const blockToHTML = block => Object(external_wp_blocks_["createBlock"])('core/html', { - content: block.originalContent -}); - -const blockToBlocks = block => Object(external_wp_blocks_["rawHandler"])({ - HTML: block.originalContent -}); - -const recoverBlock = ({ - name, - attributes, - innerBlocks -}) => Object(external_wp_blocks_["createBlock"])(name, attributes, innerBlocks); - -/* harmony default export */ var block_invalid_warning = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, { - clientId -}) => ({ - block: select(store).getBlock(clientId) -})), Object(external_wp_data_["withDispatch"])((dispatch, { - block -}) => { - const { - replaceBlock - } = dispatch(store); - return { - convertToClassic() { - replaceBlock(block.clientId, blockToClassic(block)); - }, - - convertToHTML() { - replaceBlock(block.clientId, blockToHTML(block)); - }, - - convertToBlocks() { - replaceBlock(block.clientId, blockToBlocks(block)); - }, - - attemptBlockRecovery() { - replaceBlock(block.clientId, recoverBlock(block)); - } - - }; -})])(BlockInvalidWarning)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-crash-warning.js - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - -const block_crash_warning_warning = Object(external_wp_element_["createElement"])(warning, { - className: "block-editor-block-list__block-crash-warning" -}, Object(external_wp_i18n_["__"])('This block has encountered an error and cannot be previewed.')); -/* harmony default export */ var block_crash_warning = (() => block_crash_warning_warning); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-crash-boundary.js -/** - * WordPress dependencies - */ - - -class block_crash_boundary_BlockCrashBoundary extends external_wp_element_["Component"] { - constructor() { - super(...arguments); - this.state = { - hasError: false - }; - } - - componentDidCatch() { - this.setState({ - hasError: true - }); - } - - render() { - if (this.state.hasError) { - return this.props.fallback; - } - - return this.props.children; - } - -} - -/* harmony default export */ var block_crash_boundary = (block_crash_boundary_BlockCrashBoundary); - -// EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js -var lib = __webpack_require__("O6Fj"); -var lib_default = /*#__PURE__*/__webpack_require__.n(lib); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-html.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - -function BlockHTML({ - clientId -}) { - const [html, setHtml] = Object(external_wp_element_["useState"])(''); - const block = Object(external_wp_data_["useSelect"])(select => select(store).getBlock(clientId), [clientId]); - const { - updateBlock - } = Object(external_wp_data_["useDispatch"])(store); - - const onChange = () => { - const blockType = Object(external_wp_blocks_["getBlockType"])(block.name); - const attributes = Object(external_wp_blocks_["getBlockAttributes"])(blockType, html, block.attributes); // If html is empty we reset the block to the default HTML and mark it as valid to avoid triggering an error - - const content = html ? html : Object(external_wp_blocks_["getSaveContent"])(blockType, attributes); - const isValid = html ? Object(external_wp_blocks_["isValidBlockContent"])(blockType, attributes, content) : true; - updateBlock(clientId, { - attributes, - originalContent: content, - isValid - }); // Ensure the state is updated if we reset so it displays the default content - - if (!html) { - setHtml({ - content - }); - } - }; - - Object(external_wp_element_["useEffect"])(() => { - setHtml(Object(external_wp_blocks_["getBlockContent"])(block)); - }, [block]); - return Object(external_wp_element_["createElement"])(lib_default.a, { - className: "block-editor-block-list__block-html-textarea", - value: html, - onBlur: onChange, - onChange: event => setHtml(event.target.value) - }); -} - -/* harmony default export */ var block_html = (BlockHTML); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/dom.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/dom.js const BLOCK_SELECTOR = '.block-editor-block-list__block'; +const APPENDER_SELECTOR = '.block-list-appender'; +const BLOCK_APPENDER_CLASS = '.block-editor-button-block-appender'; /** * Returns true if two elements are contained within the same block. * @@ -20543,18 +17840,18 @@ return a.closest(BLOCK_SELECTOR) === b.closest(BLOCK_SELECTOR); } /** - * Returns true if an element is considered part of the block and not its - * children. + * Returns true if an element is considered part of the block and not its inner + * blocks or appender. * * @param {Element} blockElement Block container element. * @param {Element} element Element. * - * @return {boolean} Whether element is in the block Element but not its - * children. + * @return {boolean} Whether an element is considered part of the block and not + * its inner blocks or appender. */ function isInsideRootBlock(blockElement, element) { - const parentBlock = element.closest(BLOCK_SELECTOR); + const parentBlock = element.closest([BLOCK_SELECTOR, APPENDER_SELECTOR, BLOCK_APPENDER_CLASS].join(',')); return parentBlock === blockElement; } /** @@ -20587,7 +17884,7 @@ return blockNode.id.slice('block-'.length); } -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-focus-first-element.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-focus-first-element.js /** * External dependencies */ @@ -20617,10 +17914,9 @@ */ function useInitialPosition(clientId) { - return Object(external_wp_data_["useSelect"])(select => { + return (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSelectedBlocksInitialCaretPosition, - isMultiSelecting, isNavigationMode, isBlockSelected } = select(store); @@ -20629,7 +17925,7 @@ return; } - if (isMultiSelecting() || isNavigationMode()) { + if (isNavigationMode()) { return; } // If there's no initial position, return 0 to focus the start. @@ -20648,9 +17944,18 @@ function useFocusFirstElement(clientId) { - const ref = Object(external_wp_element_["useRef"])(); + const ref = (0,external_wp_element_namespaceObject.useRef)(); const initialPosition = useInitialPosition(clientId); - Object(external_wp_element_["useEffect"])(() => { + const { + isBlockSelected, + isMultiSelecting + } = (0,external_wp_data_namespaceObject.useSelect)(store); + (0,external_wp_element_namespaceObject.useEffect)(() => { + // Check if the block is still selected at the time this effect runs. + if (!isBlockSelected(clientId) || isMultiSelecting()) { + return; + } + if (initialPosition === undefined || initialPosition === null) { return; } @@ -20668,24 +17973,33 @@ } // Find all tabbables within node. - const textInputs = external_wp_dom_["focus"].tabbable.find(ref.current).filter(node => Object(external_wp_dom_["isTextField"])(node)); // If reversed (e.g. merge via backspace), use the last in the set of + const textInputs = external_wp_dom_namespaceObject.focus.tabbable.find(ref.current).filter(node => (0,external_wp_dom_namespaceObject.isTextField)(node)); // If reversed (e.g. merge via backspace), use the last in the set of // tabbables. const isReverse = -1 === initialPosition; - const target = (isReverse ? external_lodash_["last"] : external_lodash_["first"])(textInputs) || ref.current; - - if ( // Don't focus inner block or block appenders. - !isInsideRootBlock(ref.current, target) || target.closest('.block-list-appender')) { + const target = (isReverse ? external_lodash_namespaceObject.last : external_lodash_namespaceObject.first)(textInputs) || ref.current; + + if (!isInsideRootBlock(ref.current, target)) { ref.current.focus(); return; - } - - Object(external_wp_dom_["placeCaretAtHorizontalEdge"])(target, isReverse); - }, [initialPosition]); + } // Check to see if element is focussable before a generic caret insert. + + + if (!ref.current.getAttribute('contenteditable')) { + const focusElement = external_wp_dom_namespaceObject.focus.tabbable.findNext(ref.current); // Make sure focusElement is valid, contained in the same block, and a form field. + + if (focusElement && isInsideRootBlock(ref.current, focusElement) && (0,external_wp_dom_namespaceObject.isFormElement)(focusElement)) { + focusElement.focus(); + return; + } + } + + (0,external_wp_dom_namespaceObject.placeCaretAtHorizontalEdge)(target, isReverse); + }, [initialPosition, clientId]); return ref; } -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-is-hovered.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-is-hovered.js /** * WordPress dependencies */ @@ -20713,14 +18027,14 @@ function useIsHovered() { - const isEnabled = Object(external_wp_data_["useSelect"])(select => { + const isEnabled = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isNavigationMode, getSettings } = select(store); return isNavigationMode() || getSettings().outlineMode; }, []); - return Object(external_wp_compose_["useRefEffect"])(node => { + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { if (isEnabled) { node.addEventListener('mouseout', listener); node.addEventListener('mouseover', listener); @@ -20734,7 +18048,7 @@ }, [isEnabled]); } -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-class-names.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-class-names.js /** * External dependencies */ @@ -20759,7 +18073,7 @@ */ function useBlockClassNames(clientId) { - return Object(external_wp_data_["useSelect"])(select => { + return (0,external_wp_data_namespaceObject.useSelect)(select => { const { isBlockBeingDragged, isBlockHighlighted, @@ -20778,7 +18092,7 @@ const isDragging = isBlockBeingDragged(clientId); const isSelected = isBlockSelected(clientId); const name = getBlockName(clientId); - const checkDeep = true; // "ancestor" is the more appropriate label due to "deep" check + const checkDeep = true; // "ancestor" is the more appropriate label due to "deep" check. const isAncestorOfSelectedBlock = hasSelectedInnerBlock(clientId, checkDeep); const activeEntityBlockId = getActiveBlockIdByBlockNames(spotlightEntityBlocks); @@ -20786,7 +18100,7 @@ 'is-selected': isSelected, 'is-highlighted': isBlockHighlighted(clientId), 'is-multi-selected': isBlockMultiSelected(clientId), - 'is-reusable': Object(external_wp_blocks_["isReusableBlock"])(Object(external_wp_blocks_["getBlockType"])(name)), + 'is-reusable': (0,external_wp_blocks_namespaceObject.isReusableBlock)((0,external_wp_blocks_namespaceObject.getBlockType)(name)), 'is-dragging': isDragging, 'has-child-selected': isAncestorOfSelectedBlock, 'has-active-entity': activeEntityBlockId, @@ -20797,7 +18111,7 @@ }, [clientId]); } -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-default-class-name.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-default-class-name.js /** * WordPress dependencies */ @@ -20818,20 +18132,20 @@ */ function useBlockDefaultClassName(clientId) { - return Object(external_wp_data_["useSelect"])(select => { + return (0,external_wp_data_namespaceObject.useSelect)(select => { const name = select(store).getBlockName(clientId); - const blockType = Object(external_wp_blocks_["getBlockType"])(name); - const hasLightBlockWrapper = blockType.apiVersion > 1 || Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'lightBlockWrapper', false); + const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); + const hasLightBlockWrapper = (blockType === null || blockType === void 0 ? void 0 : blockType.apiVersion) > 1; if (!hasLightBlockWrapper) { return; } - return Object(external_wp_blocks_["getBlockDefaultClassName"])(name); + return (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(name); }, [clientId]); } -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-custom-class-name.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-custom-class-name.js /** * WordPress dependencies */ @@ -20854,31 +18168,29 @@ // It's good for this to be a separate selector because it will be executed // on every attribute change, while the other selectors are not re-evaluated // as much. - return Object(external_wp_data_["useSelect"])(select => { + return (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockName, getBlockAttributes } = select(store); - const { - className - } = getBlockAttributes(clientId); - - if (!className) { - return; - } - - const blockType = Object(external_wp_blocks_["getBlockType"])(getBlockName(clientId)); - const hasLightBlockWrapper = blockType.apiVersion > 1 || Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'lightBlockWrapper', false); + const attributes = getBlockAttributes(clientId); + + if (!(attributes !== null && attributes !== void 0 && attributes.className)) { + return; + } + + const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(getBlockName(clientId)); + const hasLightBlockWrapper = (blockType === null || blockType === void 0 ? void 0 : blockType.apiVersion) > 1; if (!hasLightBlockWrapper) { return; } - return className; + return attributes.className; }, [clientId]); } -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-moving-mode-class-names.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-moving-mode-class-names.js /** * External dependencies */ @@ -20902,7 +18214,7 @@ */ function useBlockMovingModeClassNames(clientId) { - return Object(external_wp_data_["useSelect"])(select => { + return (0,external_wp_data_namespaceObject.useSelect)(select => { const { hasBlockMovingClientId, canInsertBlockType, @@ -20928,7 +18240,7 @@ }, [clientId]); } -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-focus-handler.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-focus-handler.js /** * WordPress dependencies */ @@ -20949,12 +18261,12 @@ function useFocusHandler(clientId) { const { isBlockSelected - } = Object(external_wp_data_["useSelect"])(store); + } = (0,external_wp_data_namespaceObject.useSelect)(store); const { selectBlock, selectionChange - } = Object(external_wp_data_["useDispatch"])(store); - return Object(external_wp_compose_["useRefEffect"])(node => { + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { /** * Marks the block as selected when focused and not already * selected. This specifically handles the case where block does not @@ -20964,8 +18276,14 @@ * @param {FocusEvent} event Focus event. */ function onFocus(event) { - // Check synchronously because a non-selected block might be + // When the whole editor is editable, let writing flow handle + // selection. + if (node.parentElement.closest('[contenteditable="true"]')) { + return; + } // Check synchronously because a non-selected block might be // getting data through `useSelect` asynchronously. + + if (isBlockSelected(clientId)) { // Potentially change selection away from rich text. if (!event.target.isContentEditable) { @@ -20991,7 +18309,9 @@ }, [isBlockSelected, selectBlock]); } -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +;// CONCATENATED MODULE: external ["wp","keycodes"] +var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js /** * WordPress dependencies */ @@ -21014,16 +18334,16 @@ */ function useEventHandlers(clientId) { - const isSelected = Object(external_wp_data_["useSelect"])(select => select(store).isBlockSelected(clientId), [clientId]); + const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isBlockSelected(clientId), [clientId]); const { getBlockRootClientId, getBlockIndex - } = Object(external_wp_data_["useSelect"])(store); + } = (0,external_wp_data_namespaceObject.useSelect)(store); const { insertDefaultBlock, removeBlock - } = Object(external_wp_data_["useDispatch"])(store); - return Object(external_wp_compose_["useRefEffect"])(node => { + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { if (!isSelected) { return; } @@ -21044,17 +18364,17 @@ target } = event; - if (keyCode !== external_wp_keycodes_["ENTER"] && keyCode !== external_wp_keycodes_["BACKSPACE"] && keyCode !== external_wp_keycodes_["DELETE"]) { - return; - } - - if (target !== node || Object(external_wp_dom_["isTextField"])(target)) { + if (keyCode !== external_wp_keycodes_namespaceObject.ENTER && keyCode !== external_wp_keycodes_namespaceObject.BACKSPACE && keyCode !== external_wp_keycodes_namespaceObject.DELETE) { + return; + } + + if (target !== node || (0,external_wp_dom_namespaceObject.isTextField)(target)) { return; } event.preventDefault(); - if (keyCode === external_wp_keycodes_["ENTER"]) { + if (keyCode === external_wp_keycodes_namespaceObject.ENTER) { insertDefaultBlock({}, getBlockRootClientId(clientId), getBlockIndex(clientId) + 1); } else { removeBlock(clientId); @@ -21081,7 +18401,7 @@ }, [clientId, isSelected, getBlockRootClientId, getBlockIndex, insertDefaultBlock, removeBlock]); } -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-nav-mode-exit.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-nav-mode-exit.js /** * WordPress dependencies */ @@ -21102,12 +18422,12 @@ const { isNavigationMode, isBlockSelected - } = Object(external_wp_data_["useSelect"])(store); + } = (0,external_wp_data_namespaceObject.useSelect)(store); const { setNavigationMode, selectBlock - } = Object(external_wp_data_["useDispatch"])(store); - return Object(external_wp_compose_["useRefEffect"])(node => { + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { function onMouseDown(event) { // Don't select a block if it's already handled by a child // block. @@ -21130,367 +18450,632 @@ }, [clientId, isNavigationMode, isBlockSelected, setNavigationMode]); } -// EXTERNAL MODULE: ./node_modules/dom-scroll-into-view/lib/index.js -var dom_scroll_into_view_lib = __webpack_require__("9Do8"); -var dom_scroll_into_view_lib_default = /*#__PURE__*/__webpack_require__.n(dom_scroll_into_view_lib); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-scroll-into-view.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - -function useScrollIntoView(clientId) { - const ref = Object(external_wp_element_["useRef"])(); - const isSelectionEnd = Object(external_wp_data_["useSelect"])(select => { - const { +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-intersection-observer.js +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +function useIntersectionObserver() { + const observer = (0,external_wp_element_namespaceObject.useContext)(IntersectionObserver); + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { + if (observer) { + observer.observe(node); + return () => { + observer.unobserve(node); + }; + } + }, [observer]); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/index.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + + +/** + * Internal dependencies + */ + + + + + + + + + + + + + + + + +/** + * If the block count exceeds the threshold, we disable the reordering animation + * to avoid laginess. + */ + +const BLOCK_ANIMATION_THRESHOLD = 200; +/** + * This hook is used to lightly mark an element as a block element. The element + * should be the outermost element of a block. Call this hook and pass the + * returned props to the element to mark as a block. If you define a ref for the + * element, it is important to pass the ref to this hook, which the hook in turn + * will pass to the component through the props it returns. Optionally, you can + * also pass any other props through this hook, and they will be merged and + * returned. + * + * @param {Object} props Optional. Props to pass to the element. Must contain + * the ref if one is defined. + * @param {Object} options Options for internal use only. + * @param {boolean} options.__unstableIsHtml + * + * @return {Object} Props to pass to the element to mark as a block. + */ + +function useBlockProps() { + let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let { + __unstableIsHtml + } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + const { + clientId, + className, + wrapperProps = {}, + isAligned + } = (0,external_wp_element_namespaceObject.useContext)(BlockListBlockContext); + const { + index, + mode, + name, + blockApiVersion, + blockTitle, + isPartOfSelection, + adjustScrolling, + enableAnimation + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getBlockIndex, + getBlockMode, + getBlockName, + isTyping, + getGlobalBlockCount, isBlockSelected, - getBlockSelectionEnd - } = select(store); - return isBlockSelected(clientId) || getBlockSelectionEnd() === clientId; - }, [clientId]); // Note that we can't use `useRefEffect` here, since an element change does - // not mean we can scroll. `isSelectionEnd` should be the sole dependency, - // while with `useRefEffect`, the element is a dependency as well. - - Object(external_wp_element_["useEffect"])(() => { - if (!isSelectionEnd) { - return; - } - - const extentNode = ref.current; - - if (!extentNode) { - return; - } // If the block is focused, the browser will already have scrolled into - // view if necessary. - - - if (extentNode.contains(extentNode.ownerDocument.activeElement)) { - return; - } - - const scrollContainer = Object(external_wp_dom_["getScrollContainer"])(extentNode) || extentNode.ownerDocument.defaultView; // 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 - }); - }, [isSelectionEnd]); - return ref; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-multi-selection.js -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - - - -function toggleRichText(container, toggle) { - Array.from(container.closest('.is-root-container').querySelectorAll('.rich-text')).forEach(node => { - if (toggle) { - node.setAttribute('contenteditable', true); - } else { - node.removeAttribute('contenteditable'); - } - }); -} -/** - * Sets a multi-selection based on the native selection across blocks. - * - * @param {string} clientId Block client ID. - */ - - -function useMultiSelection(clientId) { - const { - startMultiSelect, - stopMultiSelect, - multiSelect, - selectBlock - } = Object(external_wp_data_["useDispatch"])(store); - const { + isBlockMultiSelected, + isAncestorMultiSelected, + isFirstMultiSelectedBlock + } = select(store); + const isSelected = isBlockSelected(clientId); + const isPartOfMultiSelection = isBlockMultiSelected(clientId) || isAncestorMultiSelected(clientId); + const blockName = getBlockName(clientId); + const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); + return { + index: getBlockIndex(clientId), + mode: getBlockMode(clientId), + name: blockName, + blockApiVersion: (blockType === null || blockType === void 0 ? void 0 : blockType.apiVersion) || 1, + blockTitle: blockType === null || blockType === void 0 ? void 0 : blockType.title, + isPartOfSelection: isSelected || isPartOfMultiSelection, + adjustScrolling: isSelected || isFirstMultiSelectedBlock(clientId), + enableAnimation: !isTyping() && getGlobalBlockCount() <= BLOCK_ANIMATION_THRESHOLD + }; + }, [clientId]); // translators: %s: Type of block (i.e. Text, Image etc) + + const blockLabel = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Block: %s'), blockTitle); + const htmlSuffix = mode === 'html' && !__unstableIsHtml ? '-visual' : ''; + const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([props.ref, useFocusFirstElement(clientId), useBlockRefProvider(clientId), useFocusHandler(clientId), useEventHandlers(clientId), useNavModeExit(clientId), useIsHovered(), useIntersectionObserver(), use_moving_animation({ + isSelected: isPartOfSelection, + adjustScrolling, + enableAnimation, + triggerAnimationOnChange: index + })]); + const blockEditContext = useBlockEditContext(); // Ensures it warns only inside the `edit` implementation for the block. + + if (blockApiVersion < 2 && clientId === blockEditContext.clientId) { + typeof process !== "undefined" && process.env && "production" !== "production" ? 0 : void 0; + } + + return { ...wrapperProps, + ...props, + ref: mergedRefs, + id: `block-${clientId}${htmlSuffix}`, + tabIndex: 0, + role: 'document', + 'aria-label': blockLabel, + 'data-block': clientId, + 'data-type': name, + 'data-title': blockTitle, + className: classnames_default()( // The wp-block className is important for editor styles. + classnames_default()('block-editor-block-list__block', { + 'wp-block': !isAligned + }), className, props.className, wrapperProps.className, useBlockClassNames(clientId), useBlockDefaultClassName(clientId), useBlockCustomClassName(clientId), useBlockMovingModeClassNames(clientId)), + style: { ...wrapperProps.style, + ...props.style + } + }; +} +/** + * Call within a save function to get the props for the block wrapper. + * + * @param {Object} props Optional. Props to pass to the element. + */ + +useBlockProps.save = external_wp_blocks_namespaceObject.__unstableGetBlockProps; + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block.js + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + + + +/** + * Internal dependencies + */ + + + + + + + + +const BlockListBlockContext = (0,external_wp_element_namespaceObject.createContext)(); +/** + * Merges wrapper props with special handling for classNames and styles. + * + * @param {Object} propsA + * @param {Object} propsB + * + * @return {Object} Merged props. + */ + +function mergeWrapperProps(propsA, propsB) { + const newProps = { ...propsA, + ...propsB + }; + + if (propsA && propsB && propsA.className && propsB.className) { + newProps.className = classnames_default()(propsA.className, propsB.className); + } + + if (propsA && propsB && propsA.style && propsB.style) { + newProps.style = { ...propsA.style, + ...propsB.style + }; + } + + return newProps; +} + +function Block(_ref) { + let { + children, + isHtml, + ...props + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)("div", useBlockProps(props, { + __unstableIsHtml: isHtml + }), children); +} + +function BlockListBlock(_ref2) { + var _wrapperProps; + + let { + block: { + __unstableBlockSource + }, + mode, + isLocked, + canRemove, + clientId, + isSelected, isSelectionEnabled, + className, + name, + isValid, + attributes, + wrapperProps, + setAttributes, + onReplace, + onInsertBlocksAfter, + onMerge, + toggleSelection + } = _ref2; + const themeSupportsLayout = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getSettings + } = select(store); + return getSettings().supportsLayout; + }, []); + const { + removeBlock + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const onRemove = (0,external_wp_element_namespaceObject.useCallback)(() => removeBlock(clientId), [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. + + let blockEdit = (0,external_wp_element_namespaceObject.createElement)(BlockEdit, { + name: name, + isSelected: isSelected, + attributes: attributes, + setAttributes: setAttributes, + insertBlocksAfter: isLocked ? undefined : onInsertBlocksAfter, + onReplace: canRemove ? onReplace : undefined, + onRemove: canRemove ? onRemove : undefined, + mergeBlocks: canRemove ? onMerge : undefined, + clientId: clientId, + isSelectionEnabled: isSelectionEnabled, + toggleSelection: toggleSelection + }); + const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); // Determine whether the block has props to apply to the wrapper. + + if (blockType !== null && blockType !== void 0 && blockType.getEditWrapperProps) { + wrapperProps = mergeWrapperProps(wrapperProps, blockType.getEditWrapperProps(attributes)); + } + + const isAligned = wrapperProps && !!wrapperProps['data-align'] && !themeSupportsLayout; // For aligned blocks, provide a wrapper element so the block can be + // positioned relative to the block column. + // This is only kept for classic themes that don't support layout + // Historically we used to rely on extra divs and data-align to + // provide the alignments styles in the editor. + // Due to the differences between frontend and backend, we migrated + // to the layout feature, and we're now aligning the markup of frontend + // and backend. + + if (isAligned) { + blockEdit = (0,external_wp_element_namespaceObject.createElement)("div", { + className: "wp-block", + "data-align": wrapperProps['data-align'] + }, blockEdit); + } + + let block; + + if (!isValid) { + const saveContent = __unstableBlockSource ? (0,external_wp_blocks_namespaceObject.serializeRawBlock)(__unstableBlockSource) : (0,external_wp_blocks_namespaceObject.getSaveContent)(blockType, attributes); + block = (0,external_wp_element_namespaceObject.createElement)(Block, { + className: "has-warning" + }, (0,external_wp_element_namespaceObject.createElement)(block_invalid_warning, { + clientId: clientId + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, (0,external_wp_dom_namespaceObject.safeHTML)(saveContent))); + } else if (mode === 'html') { + // Render blockEdit so the inspector controls don't disappear. + // See #8969. + block = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { + style: { + display: 'none' + } + }, blockEdit), (0,external_wp_element_namespaceObject.createElement)(Block, { + isHtml: true + }, (0,external_wp_element_namespaceObject.createElement)(block_html, { + clientId: clientId + }))); + } else if ((blockType === null || blockType === void 0 ? void 0 : blockType.apiVersion) > 1) { + block = blockEdit; + } else { + block = (0,external_wp_element_namespaceObject.createElement)(Block, wrapperProps, blockEdit); + } + + const value = { + clientId, + className: (_wrapperProps = wrapperProps) !== null && _wrapperProps !== void 0 && _wrapperProps['data-align'] && themeSupportsLayout ? classnames_default()(className, `align${wrapperProps['data-align']}`) : className, + wrapperProps: (0,external_lodash_namespaceObject.omit)(wrapperProps, ['data-align']), + isAligned + }; + const memoizedValue = (0,external_wp_element_namespaceObject.useMemo)(() => value, Object.values(value)); + return (0,external_wp_element_namespaceObject.createElement)(BlockListBlockContext.Provider, { + value: memoizedValue + }, (0,external_wp_element_namespaceObject.createElement)(block_crash_boundary, { + fallback: (0,external_wp_element_namespaceObject.createElement)(Block, { + className: "has-warning" + }, (0,external_wp_element_namespaceObject.createElement)(block_crash_warning, null)) + }, block)); +} + +const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)((select, _ref3) => { + let { + clientId, + rootClientId + } = _ref3; + const { isBlockSelected, - getBlockParents, - getBlockSelectionStart, - hasMultiSelection - } = Object(external_wp_data_["useSelect"])(store); - return Object(external_wp_compose_["useRefEffect"])(node => { - const { - ownerDocument - } = node; - const { - defaultView - } = ownerDocument; - let anchorElement; - let rafId; - - function onSelectionChange({ - isSelectionEnd - }) { - const selection = defaultView.getSelection(); // If no selection is found, end multi selection and enable all rich - // text areas. - - if (!selection.rangeCount || selection.isCollapsed) { - toggleRichText(node, true); - return; - } - - const endClientId = getBlockClientId(selection.focusNode); - const isSingularSelection = clientId === endClientId; - - if (isSingularSelection) { - selectBlock(clientId); // If the selection is complete (on mouse up), and no - // multiple blocks have been selected, set focus back to the - // anchor element. if the anchor element contains the - // selection. Additionally, rich text elements that were - // previously disabled can now be enabled again. - - if (isSelectionEnd) { - toggleRichText(node, true); - - if (selection.rangeCount) { - const { - commonAncestorContainer - } = selection.getRangeAt(0); - - if (anchorElement.contains(commonAncestorContainer)) { - anchorElement.focus(); - } - } + getBlockMode, + isSelectionEnabled, + getTemplateLock, + __unstableGetBlockWithoutInnerBlocks, + canRemoveBlock, + canMoveBlock + } = select(store); + + const block = __unstableGetBlockWithoutInnerBlocks(clientId); + + const isSelected = isBlockSelected(clientId); + const templateLock = getTemplateLock(rootClientId); + const canRemove = canRemoveBlock(clientId, rootClientId); + const canMove = canMoveBlock(clientId, rootClientId); // 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. + + const { + name, + attributes, + isValid + } = block || {}; // Do not add new properties here, use `useSelect` instead to avoid + // leaking new props to the public API (editor.BlockListBlock filter). + + return { + mode: getBlockMode(clientId), + isSelectionEnabled: isSelectionEnabled(), + isLocked: !!templateLock, + canRemove, + canMove, + // 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, + name, + attributes, + isValid, + isSelected + }; +}); +const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, _ref4) => { + let { + select + } = _ref4; + const { + updateBlockAttributes, + insertBlocks, + mergeBlocks, + replaceBlocks, + toggleSelection, + __unstableMarkLastChangeAsPersistent + } = dispatch(store); // Do not add new properties here, use `useDispatch` instead to avoid + // leaking new props to the public API (editor.BlockListBlock filter). + + return { + setAttributes(newAttributes) { + const { + getMultiSelectedBlockClientIds + } = select(store); + const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(); + const { + clientId + } = ownProps; + const clientIds = multiSelectedBlockClientIds.length ? multiSelectedBlockClientIds : [clientId]; + updateBlockAttributes(clientIds, newAttributes); + }, + + onInsertBlocks(blocks, index) { + const { + rootClientId + } = ownProps; + insertBlocks(blocks, index, rootClientId); + }, + + onInsertBlocksAfter(blocks) { + const { + clientId, + rootClientId + } = ownProps; + const { + getBlockIndex + } = select(store); + const index = getBlockIndex(clientId); + insertBlocks(blocks, index + 1, rootClientId); + }, + + onMerge(forward) { + const { + clientId + } = ownProps; + const { + getPreviousBlockClientId, + getNextBlockClientId + } = select(store); + + if (forward) { + const nextBlockClientId = getNextBlockClientId(clientId); + + if (nextBlockClientId) { + mergeBlocks(clientId, nextBlockClientId); } } else { - const startPath = [...getBlockParents(clientId), clientId]; - const endPath = [...getBlockParents(endClientId), endClientId]; - const depth = Math.min(startPath.length, endPath.length) - 1; - multiSelect(startPath[depth], endPath[depth]); - } - } - - function onSelectionEnd() { - ownerDocument.removeEventListener('selectionchange', onSelectionChange); // Equivalent to attaching the listener once. - - defaultView.removeEventListener('mouseup', onSelectionEnd); // The browser selection won't have updated yet at this point, - // so wait until the next animation frame to get the browser - // selection. - - rafId = defaultView.requestAnimationFrame(() => { - onSelectionChange({ - isSelectionEnd: true - }); - stopMultiSelect(); - }); - } - - function onMouseLeave({ - buttons - }) { - // The primary button must be pressed to initiate selection. - // See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons - if (buttons !== 1) { - return; - } - - if (!isSelectionEnabled() || !isBlockSelected(clientId)) { - return; - } - - anchorElement = ownerDocument.activeElement; - startMultiSelect(); // `onSelectionStart` is called after `mousedown` and - // `mouseleave` (from a block). The selection ends when - // `mouseup` happens anywhere in the window. - - ownerDocument.addEventListener('selectionchange', onSelectionChange); - defaultView.addEventListener('mouseup', onSelectionEnd); // Removing the contenteditable attributes within the block - // editor is essential for selection to work across editable - // areas. The edible hosts are removed, allowing selection to be - // extended outside the DOM element. `startMultiSelect` sets a - // flag in the store so the rich text components are updated, - // but the rerender may happen very slowly, especially in Safari - // for the blocks that are asynchonously rendered. To ensure the - // browser instantly removes the selection boundaries, we remove - // the contenteditable attributes manually. - - toggleRichText(node, false); - } - - function onMouseDown(event) { - // The main button. - // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button - if (!isSelectionEnabled() || event.button !== 0) { - return; - } - - if (event.shiftKey) { - const blockSelectionStart = getBlockSelectionStart(); - - if (blockSelectionStart !== clientId) { - toggleRichText(node, false); - multiSelect(blockSelectionStart, clientId); - event.preventDefault(); - } - } else if (hasMultiSelection()) { - // Allow user to escape out of a multi-selection to a - // singular selection of a block via click. This is handled - // here since focus handling excludes blocks when there is - // multiselection, as focus can be incurred by starting a - // multiselection (focus moved to first block's multi- - // controls). - selectBlock(clientId); - } - } - - node.addEventListener('mousedown', onMouseDown); - node.addEventListener('mouseleave', onMouseLeave); - return () => { - node.removeEventListener('mousedown', onMouseDown); - node.removeEventListener('mouseleave', onMouseLeave); - ownerDocument.removeEventListener('selectionchange', onSelectionChange); - defaultView.removeEventListener('mouseup', onSelectionEnd); - defaultView.cancelAnimationFrame(rafId); - }; - }, [clientId, startMultiSelect, stopMultiSelect, multiSelect, selectBlock, isSelectionEnabled, isBlockSelected, getBlockParents]); -} - -// EXTERNAL MODULE: external ["wp","htmlEntities"] -var external_wp_htmlEntities_ = __webpack_require__("rmEH"); - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js -var plus = __webpack_require__("Q4Sy"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/tips.js - - -/** - * WordPress dependencies - */ - - - -const globalTips = [Object(external_wp_element_["createInterpolateElement"])(Object(external_wp_i18n_["__"])('While writing, you can press / to quickly insert new blocks.'), { - kbd: Object(external_wp_element_["createElement"])("kbd", null) -}), Object(external_wp_element_["createInterpolateElement"])(Object(external_wp_i18n_["__"])('Indent a list by pressing space at the beginning of a line.'), { - kbd: Object(external_wp_element_["createElement"])("kbd", null) -}), Object(external_wp_element_["createInterpolateElement"])(Object(external_wp_i18n_["__"])('Outdent a list by pressing backspace at the beginning of a line.'), { - kbd: Object(external_wp_element_["createElement"])("kbd", null) -}), Object(external_wp_i18n_["__"])('Drag files into the editor to automatically insert media blocks.'), Object(external_wp_i18n_["__"])("Change a block's type by pressing the block icon on the toolbar.")]; + const previousBlockClientId = getPreviousBlockClientId(clientId); + + if (previousBlockClientId) { + mergeBlocks(previousBlockClientId, clientId); + } + } + }, + + onReplace(blocks, indexToSelect, initialPosition) { + if (blocks.length && !(0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blocks[blocks.length - 1])) { + __unstableMarkLastChangeAsPersistent(); + } + + replaceBlocks([ownProps.clientId], blocks, indexToSelect, initialPosition); + }, + + toggleSelection(selectionEnabled) { + toggleSelection(selectionEnabled); + } + + }; +}); +/* harmony default export */ var block = ((0,external_wp_compose_namespaceObject.compose)(external_wp_compose_namespaceObject.pure, applyWithSelect, applyWithDispatch, // Block is sometimes not mounted at the right time, causing it be undefined +// see issue for more info +// https://github.com/WordPress/gutenberg/issues/17013 +(0,external_wp_compose_namespaceObject.ifCondition)(_ref5 => { + let { + block + } = _ref5; + return !!block; +}), (0,external_wp_components_namespaceObject.withFilters)('editor.BlockListBlock'))(BlockListBlock)); + +;// CONCATENATED MODULE: external ["wp","htmlEntities"] +var external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js + + +/** + * WordPress dependencies + */ + +const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z" +})); +/* harmony default export */ var library_plus = (plus); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/tips.js + + +/** + * WordPress dependencies + */ + + + +const globalTips = [(0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('While writing, you can press / to quickly insert new blocks.'), { + kbd: (0,external_wp_element_namespaceObject.createElement)("kbd", null) +}), (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Indent a list by pressing space at the beginning of a line.'), { + kbd: (0,external_wp_element_namespaceObject.createElement)("kbd", null) +}), (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Outdent a list by pressing backspace at the beginning of a line.'), { + kbd: (0,external_wp_element_namespaceObject.createElement)("kbd", null) +}), (0,external_wp_i18n_namespaceObject.__)('Drag files into the editor to automatically insert media blocks.'), (0,external_wp_i18n_namespaceObject.__)("Change a block's type by pressing the block icon on the toolbar.")]; function Tips() { - const [randomIndex] = Object(external_wp_element_["useState"])( // Disable Reason: I'm not generating an HTML id. + const [randomIndex] = (0,external_wp_element_namespaceObject.useState)( // Disable Reason: I'm not generating an HTML id. // eslint-disable-next-line no-restricted-syntax Math.floor(Math.random() * globalTips.length)); - return Object(external_wp_element_["createElement"])(external_wp_components_["Tip"], null, globalTips[randomIndex]); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Tip, null, globalTips[randomIndex]); } /* harmony default export */ var tips = (Tips); -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js -var close_small = __webpack_require__("bWcr"); - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js -var search = __webpack_require__("cGtP"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/search-form.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - - -function InserterSearchForm({ - className, - onChange, - value, - label, - placeholder -}) { - const instanceId = Object(external_wp_compose_["useInstanceId"])(InserterSearchForm); - const searchInput = Object(external_wp_element_["useRef"])(); - return Object(external_wp_element_["createElement"])("div", { - className: classnames_default()('block-editor-inserter__search', className) - }, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { - as: "label", - htmlFor: `block-editor-inserter__search-${instanceId}` - }, label || placeholder), Object(external_wp_element_["createElement"])("input", { - ref: searchInput, - className: "block-editor-inserter__search-input", - id: `block-editor-inserter__search-${instanceId}`, - type: "search", - placeholder: placeholder, - onChange: event => onChange(event.target.value), - autoComplete: "off", - value: value || '' - }), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-inserter__search-icon" - }, !!value && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - icon: close_small["a" /* default */], - label: Object(external_wp_i18n_["__"])('Reset search'), - onClick: () => { - onChange(''); - searchInput.current.focus(); - } - }), !value && Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { - icon: search["a" /* default */] - }))); -} - -/* harmony default export */ var search_form = (InserterSearchForm); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-card/index.js - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - - -function BlockCard({ - title, - icon, - description, - blockType -}) { +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js + + +/** + * WordPress dependencies + */ + +const blockDefault = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" +})); +/* harmony default export */ var block_default = (blockDefault); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-icon/index.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + +function BlockIcon(_ref) { + var _icon; + + let { + icon, + showColors = false, + className + } = _ref; + + if (((_icon = icon) === null || _icon === void 0 ? void 0 : _icon.src) === 'block-default') { + icon = { + src: block_default + }; + } + + const renderedIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { + icon: icon && icon.src ? icon.src : icon + }); + const style = showColors ? { + backgroundColor: icon && icon.background, + color: icon && icon.foreground + } : {}; + return (0,external_wp_element_namespaceObject.createElement)("span", { + style: style, + className: classnames_default()('block-editor-block-icon', className, { + 'has-colors': showColors + }) + }, renderedIcon); +} +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-icon/README.md + */ + + +/* harmony default export */ var block_icon = ((0,external_wp_element_namespaceObject.memo)(BlockIcon)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-card/index.js + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + +function BlockCard(_ref) { + let { + title, + icon, + description, + blockType + } = _ref; + if (blockType) { external_wp_deprecated_default()('`blockType` property in `BlockCard component`', { since: '5.7', @@ -21503,53 +19088,55 @@ } = blockType); } - return Object(external_wp_element_["createElement"])("div", { + return (0,external_wp_element_namespaceObject.createElement)("div", { className: "block-editor-block-card" - }, Object(external_wp_element_["createElement"])(BlockIcon, { + }, (0,external_wp_element_namespaceObject.createElement)(block_icon, { icon: icon, showColors: true - }), Object(external_wp_element_["createElement"])("div", { + }), (0,external_wp_element_namespaceObject.createElement)("div", { className: "block-editor-block-card__content" - }, Object(external_wp_element_["createElement"])("h2", { + }, (0,external_wp_element_namespaceObject.createElement)("h2", { className: "block-editor-block-card__title" - }, title), Object(external_wp_element_["createElement"])("span", { + }, title), (0,external_wp_element_namespaceObject.createElement)("span", { className: "block-editor-block-card__description" }, description))); } /* harmony default export */ var block_card = (BlockCard); -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/with-registry-provider.js - - - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - -const withRegistryProvider = Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => { - return Object(external_wp_data_["withRegistry"])(({ - useSubRegistry = true, - registry, - ...props - }) => { +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/with-registry-provider.js + + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + +const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => { + return (0,external_wp_data_namespaceObject.withRegistry)(_ref => { + let { + useSubRegistry = true, + registry, + ...props + } = _ref; + if (!useSubRegistry) { - return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({ + return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, _extends({ registry: registry }, props)); } - const [subRegistry, setSubRegistry] = Object(external_wp_element_["useState"])(null); - Object(external_wp_element_["useEffect"])(() => { - const newRegistry = Object(external_wp_data_["createRegistry"])({}, registry); + const [subRegistry, setSubRegistry] = (0,external_wp_element_namespaceObject.useState)(null); + (0,external_wp_element_namespaceObject.useEffect)(() => { + const newRegistry = (0,external_wp_data_namespaceObject.createRegistry)({}, registry); newRegistry.registerStore(STORE_NAME, storeConfig); setSubRegistry(newRegistry); }, [registry]); @@ -21558,16 +19145,16 @@ return null; } - return Object(external_wp_element_["createElement"])(external_wp_data_["RegistryProvider"], { + return (0,external_wp_element_namespaceObject.createElement)(external_wp_data_namespaceObject.RegistryProvider, { value: subRegistry - }, Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({ + }, (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, _extends({ registry: subRegistry }, props))); }); }, 'withRegistryProvider'); /* harmony default export */ var with_registry_provider = (withRegistryProvider); -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/use-block-sync.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/use-block-sync.js /** * External dependencies */ @@ -21615,35 +19202,36 @@ * controllers. * - Passes selection state from the block-editor store to the controlling entity. * - * @param {Object} props Props for the block sync hook - * @param {string} props.clientId The client ID of the inner block controller. - * If none is passed, then it is assumed to be a - * root controller rather than an inner block - * controller. - * @param {Object[]} props.value The control value for the blocks. This value - * is used to initalize the block-editor store - * and for resetting the blocks to incoming - * changes like undo. - * @param {Object} props.selection The selection state responsible to restore the selection on undo/redo. - * @param {onBlockUpdate} props.onChange Function to call when a persistent - * change has been made in the block-editor blocks - * for the given clientId. For example, after - * this function is called, an entity is marked - * dirty because it has changes to save. - * @param {onBlockUpdate} props.onInput Function to call when a non-persistent - * change has been made in the block-editor blocks - * for the given clientId. When this is called, - * controlling sources do not become dirty. - */ - -function useBlockSync({ - clientId = null, - value: controlledBlocks, - selection: controlledSelection, - onChange = external_lodash_["noop"], - onInput = external_lodash_["noop"] -}) { - const registry = Object(external_wp_data_["useRegistry"])(); + * @param {Object} props Props for the block sync hook + * @param {string} props.clientId The client ID of the inner block controller. + * If none is passed, then it is assumed to be a + * root controller rather than an inner block + * controller. + * @param {Object[]} props.value The control value for the blocks. This value + * is used to initalize the block-editor store + * and for resetting the blocks to incoming + * changes like undo. + * @param {Object} props.selection The selection state responsible to restore the selection on undo/redo. + * @param {onBlockUpdate} props.onChange Function to call when a persistent + * change has been made in the block-editor blocks + * for the given clientId. For example, after + * this function is called, an entity is marked + * dirty because it has changes to save. + * @param {onBlockUpdate} props.onInput Function to call when a non-persistent + * change has been made in the block-editor blocks + * for the given clientId. When this is called, + * controlling sources do not become dirty. + */ + +function useBlockSync(_ref) { + let { + clientId = null, + value: controlledBlocks, + selection: controlledSelection, + onChange = external_lodash_namespaceObject.noop, + onInput = external_lodash_namespaceObject.noop + } = _ref; + const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { resetBlocks, resetSelection, @@ -21655,11 +19243,14 @@ getBlockName, getBlocks } = registry.select(store); - const pendingChanges = Object(external_wp_element_["useRef"])({ + const isControlled = (0,external_wp_data_namespaceObject.useSelect)(select => { + return !clientId || select(store).areInnerBlocksControlled(clientId); + }, [clientId]); + const pendingChanges = (0,external_wp_element_namespaceObject.useRef)({ incoming: null, outgoing: [] }); - const subscribed = Object(external_wp_element_["useRef"])(false); + const subscribed = (0,external_wp_element_namespaceObject.useRef)(false); const setControlledBlocks = () => { if (!controlledBlocks) { @@ -21672,17 +19263,22 @@ __unstableMarkNextChangeAsNotPersistent(); if (clientId) { - setHasControlledInnerBlocks(clientId, true); - - __unstableMarkNextChangeAsNotPersistent(); - - const storeBlocks = controlledBlocks.map(block => Object(external_wp_blocks_["cloneBlock"])(block)); - - if (subscribed.current) { - pendingChanges.current.incoming = storeBlocks; - } - - replaceInnerBlocks(clientId, storeBlocks); + // It is important to batch here because otherwise, + // as soon as `setHasControlledInnerBlocks` is called + // the effect to restore might be triggered + // before the actual blocks get set properly in state. + registry.batch(() => { + setHasControlledInnerBlocks(clientId, true); + const storeBlocks = controlledBlocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block)); + + if (subscribed.current) { + pendingChanges.current.incoming = storeBlocks; + } + + __unstableMarkNextChangeAsNotPersistent(); + + replaceInnerBlocks(clientId, storeBlocks); + }); } else { if (subscribed.current) { pendingChanges.current.incoming = controlledBlocks; @@ -21696,14 +19292,14 @@ // waiting for React renders for changes. - const onInputRef = Object(external_wp_element_["useRef"])(onInput); - const onChangeRef = Object(external_wp_element_["useRef"])(onChange); - Object(external_wp_element_["useEffect"])(() => { + const onInputRef = (0,external_wp_element_namespaceObject.useRef)(onInput); + const onChangeRef = (0,external_wp_element_namespaceObject.useRef)(onChange); + (0,external_wp_element_namespaceObject.useEffect)(() => { onInputRef.current = onInput; onChangeRef.current = onChange; }, [onInput, onChange]); // Determine if blocks need to be reset when they change. - Object(external_wp_element_["useEffect"])(() => { + (0,external_wp_element_namespaceObject.useEffect)(() => { if (pendingChanges.current.outgoing.includes(controlledBlocks)) { // Skip block reset if the value matches expected outbound sync // triggered by this component by a preceding change detection. @@ -21711,7 +19307,7 @@ // still occur if the value is modified (not equal by reference), // to allow that the consumer may apply modifications to reflect // back on the editor. - if (Object(external_lodash_["last"])(pendingChanges.current.outgoing) === controlledBlocks) { + if ((0,external_lodash_namespaceObject.last)(pendingChanges.current.outgoing) === controlledBlocks) { pendingChanges.current.outgoing = []; } } else if (getBlocks(clientId) !== controlledBlocks) { @@ -21727,13 +19323,22 @@ } } }, [controlledBlocks, clientId]); - Object(external_wp_element_["useEffect"])(() => { + (0,external_wp_element_namespaceObject.useEffect)(() => { + // When the block becomes uncontrolled, it means its inner state has been reset + // we need to take the blocks again from the external value property. + if (!isControlled) { + pendingChanges.current.outgoing = []; + setControlledBlocks(); + } + }, [isControlled]); + (0,external_wp_element_namespaceObject.useEffect)(() => { const { getSelectionStart, getSelectionEnd, getSelectedBlocksInitialCaretPosition, isLastBlockChangePersistent, - __unstableIsLastBlockChangeIgnored + __unstableIsLastBlockChangeIgnored, + areInnerBlocksControlled } = registry.select(store); let blocks = getBlocks(clientId); let isPersistent = isLastBlockChangePersistent(); @@ -21747,7 +19352,17 @@ // the subscription is triggering for a block (`clientId !== null`) // and its block name can't be found because it's not on the list. // (`getBlockName( clientId ) === null`). - if (clientId !== null && getBlockName(clientId) === null) return; + if (clientId !== null && getBlockName(clientId) === null) return; // When RESET_BLOCKS on parent blocks get called, the controlled blocks + // can reset to uncontrolled, in these situations, it means we need to populate + // the blocks again from the external blocks (the value property here) + // and we should stop triggering onChange + + const isStillControlled = !clientId || areInnerBlocksControlled(clientId); + + if (!isStillControlled) { + return; + } + const newIsPersistent = isLastBlockChangePersistent(); const newBlocks = getBlocks(clientId); const areBlocksDifferent = newBlocks !== blocks; @@ -21789,7 +19404,7 @@ }, [registry, clientId]); } -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/index.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/index.js /** @@ -21814,6400 +19429,42 @@ } = props; const { updateSettings - } = Object(external_wp_data_["useDispatch"])(store); - Object(external_wp_element_["useEffect"])(() => { + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + (0,external_wp_element_namespaceObject.useEffect)(() => { updateSettings(settings); }, [settings]); // Syncs the entity provider with changes in the block-editor store. useBlockSync(props); - return Object(external_wp_element_["createElement"])(BlockRefsProvider, null, children); + return (0,external_wp_element_namespaceObject.createElement)(BlockRefsProvider, null, children); } /* harmony default export */ var provider = (with_registry_provider(BlockEditorProvider)); -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-preview/live.js - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - -function LiveBlockPreview({ - onClick -}) { - return Object(external_wp_element_["createElement"])("div", { +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-preview/live.js + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + +function LiveBlockPreview(_ref) { + let { + onClick + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)("div", { tabIndex: 0, role: "button", onClick: onClick, onKeyPress: onClick - }, Object(external_wp_element_["createElement"])(external_wp_components_["Disabled"], null, Object(external_wp_element_["createElement"])(BlockList, null))); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-preview/auto.js - - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - // This is used to avoid rendering the block list if the sizes change. - -let MemoizedBlockList; - -function AutoBlockPreview({ - viewportWidth, - __experimentalPadding -}) { - const [containerResizeListener, { - width: containerWidth - }] = Object(external_wp_compose_["useResizeObserver"])(); - const [containtResizeListener, { - height: contentHeight - }] = Object(external_wp_compose_["useResizeObserver"])(); // Initialize on render instead of module top level, to avoid circular dependency issues. - - MemoizedBlockList = MemoizedBlockList || Object(external_wp_compose_["pure"])(BlockList); - const scale = (containerWidth - 2 * __experimentalPadding) / viewportWidth; - return Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-preview__container editor-styles-wrapper", - "aria-hidden": true, - style: { - height: contentHeight * scale + 2 * __experimentalPadding - } - }, containerResizeListener, Object(external_wp_element_["createElement"])(external_wp_components_["Disabled"], { - style: { - transform: `scale(${scale})`, - width: viewportWidth, - left: __experimentalPadding, - right: __experimentalPadding, - top: __experimentalPadding - }, - className: "block-editor-block-preview__content" - }, containtResizeListener, Object(external_wp_element_["createElement"])(MemoizedBlockList, null))); -} - -/* harmony default export */ var auto = (AutoBlockPreview); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-preview/index.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - - - -function BlockPreview({ - blocks, - __experimentalPadding = 0, - viewportWidth = 1200, - __experimentalLive = false, - __experimentalOnClick -}) { - const originalSettings = Object(external_wp_data_["useSelect"])(select => select(store).getSettings(), []); - const settings = Object(external_wp_element_["useMemo"])(() => { - const _settings = { ...originalSettings - }; - _settings.__experimentalBlockPatterns = []; - return _settings; - }, [originalSettings]); - const renderedBlocks = Object(external_wp_element_["useMemo"])(() => Object(external_lodash_["castArray"])(blocks), [blocks]); - - if (!blocks || blocks.length === 0) { - return null; - } - - return Object(external_wp_element_["createElement"])(provider, { - value: renderedBlocks, - settings: settings - }, __experimentalLive ? Object(external_wp_element_["createElement"])(LiveBlockPreview, { - onClick: __experimentalOnClick - }) : Object(external_wp_element_["createElement"])(auto, { - viewportWidth: viewportWidth, - __experimentalPadding: __experimentalPadding - })); -} -/** - * BlockPreview renders a preview of a block or array of blocks. - * - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-preview/README.md - * - * @param {Object} preview options for how the preview should be shown - * @param {Array|Object} preview.blocks A block instance (object) or an array of blocks to be previewed. - * @param {number} preview.viewportWidth Width of the preview container in pixels. Controls at what size the blocks will be rendered inside the preview. Default: 700. - * - * @return {WPComponent} The component to be rendered. - */ - -/* harmony default export */ var block_preview = (Object(external_wp_element_["memo"])(BlockPreview)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/preview-panel.js - - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - - - -function InserterPreviewPanel({ - item -}) { - var _hoveredItemBlockType, _hoveredItemBlockType2; - - const { - name, - title, - icon, - description, - initialAttributes - } = item; - const hoveredItemBlockType = Object(external_wp_blocks_["getBlockType"])(name); - const isReusable = Object(external_wp_blocks_["isReusableBlock"])(item); - return Object(external_wp_element_["createElement"])("div", { - className: "block-editor-inserter__preview-container" - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-inserter__preview" - }, isReusable || hoveredItemBlockType.example ? Object(external_wp_element_["createElement"])("div", { - className: "block-editor-inserter__preview-content" - }, Object(external_wp_element_["createElement"])(block_preview, { - __experimentalPadding: 16, - viewportWidth: (_hoveredItemBlockType = (_hoveredItemBlockType2 = hoveredItemBlockType.example) === null || _hoveredItemBlockType2 === void 0 ? void 0 : _hoveredItemBlockType2.viewportWidth) !== null && _hoveredItemBlockType !== void 0 ? _hoveredItemBlockType : 500, - blocks: hoveredItemBlockType.example ? Object(external_wp_blocks_["getBlockFromExample"])(item.name, { - attributes: { ...hoveredItemBlockType.example.attributes, - ...initialAttributes - }, - innerBlocks: hoveredItemBlockType.example.innerBlocks - }) : Object(external_wp_blocks_["createBlock"])(name, initialAttributes) - })) : Object(external_wp_element_["createElement"])("div", { - className: "block-editor-inserter__preview-content-missing" - }, Object(external_wp_i18n_["__"])('No Preview Available.'))), !isReusable && Object(external_wp_element_["createElement"])(block_card, { - title: title, - icon: icon, - description: description - })); -} - -/* harmony default export */ var preview_panel = (InserterPreviewPanel); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/context.js -/** - * WordPress dependencies - */ - -const InserterListboxContext = Object(external_wp_element_["createContext"])(); -/* harmony default export */ var inserter_listbox_context = (InserterListboxContext); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/item.js - - - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - - -function InserterListboxItem({ - isFirst, - as: Component, - children, - ...props -}, ref) { - const state = Object(external_wp_element_["useContext"])(inserter_listbox_context); - return Object(external_wp_element_["createElement"])(external_wp_components_["__unstableCompositeItem"], Object(esm_extends["a" /* default */])({ - ref: ref, - state: state, - role: "option" // Use the CompositeItem `focusable` prop over Button's - // isFocusable. The latter was shown to cause an issue - // with tab order in the inserter list. - , - focusable: true - }, props), htmlProps => { - const propsWithTabIndex = { ...htmlProps, - tabIndex: isFirst ? 0 : htmlProps.tabIndex - }; - - if (Component) { - return Object(external_wp_element_["createElement"])(Component, propsWithTabIndex, children); - } - - if (typeof children === 'function') { - return children(propsWithTabIndex); - } - - return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], propsWithTabIndex, children); - }); -} - -/* harmony default export */ var inserter_listbox_item = (Object(external_wp_element_["forwardRef"])(InserterListboxItem)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/drag-handle.js - - -/** - * WordPress dependencies - */ - -const dragHandle = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { - width: "18", - height: "18", - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 18 18" -}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { - d: "M5 4h2V2H5v2zm6-2v2h2V2h-2zm-6 8h2V8H5v2zm6 0h2V8h-2v2zm-6 6h2v-2H5v2zm6 0h2v-2h-2v2z" -})); -/* harmony default export */ var drag_handle = (dragHandle); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/draggable-chip.js - - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - -function BlockDraggableChip({ - count, - icon -}) { - return Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-draggable-chip-wrapper" - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-draggable-chip" - }, Object(external_wp_element_["createElement"])(external_wp_components_["Flex"], { - justify: "center", - className: "block-editor-block-draggable-chip__content" - }, Object(external_wp_element_["createElement"])(external_wp_components_["FlexItem"], null, icon ? Object(external_wp_element_["createElement"])(BlockIcon, { - icon: icon - }) : Object(external_wp_i18n_["sprintf"])( - /* translators: %d: Number of blocks. */ - Object(external_wp_i18n_["_n"])('%d block', '%d blocks', count), count)), Object(external_wp_element_["createElement"])(external_wp_components_["FlexItem"], null, Object(external_wp_element_["createElement"])(BlockIcon, { - icon: drag_handle - }))))); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-draggable-blocks/index.js - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - - -const InserterDraggableBlocks = ({ - isEnabled, - blocks, - icon, - children -}) => { - const transferData = { - type: 'inserter', - blocks - }; - return Object(external_wp_element_["createElement"])(external_wp_components_["Draggable"], { - __experimentalTransferDataType: "wp-blocks", - transferData: transferData, - __experimentalDragComponent: Object(external_wp_element_["createElement"])(BlockDraggableChip, { - count: blocks.length, - icon: icon - }) - }, ({ - onDraggableStart, - onDraggableEnd - }) => { - return children({ - draggable: isEnabled, - onDragStart: isEnabled ? onDraggableStart : undefined, - onDragEnd: isEnabled ? onDraggableEnd : undefined - }); - }); -}; - -/* harmony default export */ var inserter_draggable_blocks = (InserterDraggableBlocks); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-list-item/index.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - -/** - * Return true if platform is MacOS. - * - * @param {Object} _window window object by default; used for DI testing. - * - * @return {boolean} True if MacOS; false otherwise. - */ - -function isAppleOS(_window = window) { - const { - platform - } = _window.navigator; - return platform.indexOf('Mac') !== -1 || ['iPad', 'iPhone'].includes(platform); -} - -function InserterListItem({ - className, - isFirst, - item, - onSelect, - onHover, - isDraggable, - ...props -}) { - const isDragging = Object(external_wp_element_["useRef"])(false); - const itemIconStyle = item.icon ? { - backgroundColor: item.icon.background, - color: item.icon.foreground - } : {}; - const blocks = Object(external_wp_element_["useMemo"])(() => { - return [Object(external_wp_blocks_["createBlock"])(item.name, item.initialAttributes, Object(external_wp_blocks_["createBlocksFromInnerBlocksTemplate"])(item.innerBlocks))]; - }, [item.name, item.initialAttributes, item.initialAttributes]); - return Object(external_wp_element_["createElement"])(inserter_draggable_blocks, { - isEnabled: isDraggable && !item.disabled, - blocks: blocks, - icon: item.icon - }, ({ - draggable, - onDragStart, - onDragEnd - }) => Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-types-list__list-item", - draggable: draggable, - onDragStart: event => { - isDragging.current = true; - - if (onDragStart) { - onHover(null); - onDragStart(event); - } - }, - onDragEnd: event => { - isDragging.current = false; - - if (onDragEnd) { - onDragEnd(event); - } - } - }, Object(external_wp_element_["createElement"])(inserter_listbox_item, Object(esm_extends["a" /* default */])({ - isFirst: isFirst, - className: classnames_default()('block-editor-block-types-list__item', className), - disabled: item.isDisabled, - onClick: event => { - event.preventDefault(); - onSelect(item, isAppleOS() ? event.metaKey : event.ctrlKey); - onHover(null); - }, - onKeyDown: event => { - const { - keyCode - } = event; - - if (keyCode === external_wp_keycodes_["ENTER"]) { - event.preventDefault(); - onSelect(item, isAppleOS() ? event.metaKey : event.ctrlKey); - onHover(null); - } - }, - onFocus: () => { - if (isDragging.current) { - return; - } - - onHover(item); - }, - onMouseEnter: () => { - if (isDragging.current) { - return; - } - - onHover(item); - }, - onMouseLeave: () => onHover(null), - onBlur: () => onHover(null) - }, props), Object(external_wp_element_["createElement"])("span", { - className: "block-editor-block-types-list__item-icon", - style: itemIconStyle - }, Object(external_wp_element_["createElement"])(BlockIcon, { - icon: item.icon, - showColors: true - })), Object(external_wp_element_["createElement"])("span", { - className: "block-editor-block-types-list__item-title" - }, item.title)))); -} - -/* harmony default export */ var inserter_list_item = (Object(external_wp_element_["memo"])(InserterListItem)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/group.js - - - -/** - * WordPress dependencies - */ - - - - -function InserterListboxGroup(props, ref) { - const [shouldSpeak, setShouldSpeak] = Object(external_wp_element_["useState"])(false); - Object(external_wp_element_["useEffect"])(() => { - if (shouldSpeak) { - Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('Use left and right arrow keys to move through blocks')); - } - }, [shouldSpeak]); - return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ - ref: ref, - role: "listbox", - "aria-orientation": "horizontal", - onFocus: () => { - setShouldSpeak(true); - }, - onBlur: event => { - const focusingOutsideGroup = !event.currentTarget.contains(event.relatedTarget); - - if (focusingOutsideGroup) { - setShouldSpeak(false); - } - } - }, props)); -} - -/* harmony default export */ var inserter_listbox_group = (Object(external_wp_element_["forwardRef"])(InserterListboxGroup)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/row.js - - - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - - -function InserterListboxRow(props, ref) { - const state = Object(external_wp_element_["useContext"])(inserter_listbox_context); - return Object(external_wp_element_["createElement"])(external_wp_components_["__unstableCompositeGroup"], Object(esm_extends["a" /* default */])({ - state: state, - role: "presentation", - ref: ref - }, props)); -} - -/* harmony default export */ var inserter_listbox_row = (Object(external_wp_element_["forwardRef"])(InserterListboxRow)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-types-list/index.js - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - - - -function chunk(array, size) { - const chunks = []; - - for (let i = 0, j = array.length; i < j; i += size) { - chunks.push(array.slice(i, i + size)); - } - - return chunks; -} - -function BlockTypesList({ - items = [], - onSelect, - onHover = () => {}, - children, - label, - isDraggable = true -}) { - return Object(external_wp_element_["createElement"])(inserter_listbox_group, { - className: "block-editor-block-types-list", - "aria-label": label - }, chunk(items, 3).map((row, i) => Object(external_wp_element_["createElement"])(inserter_listbox_row, { - key: i - }, row.map((item, j) => Object(external_wp_element_["createElement"])(inserter_list_item, { - key: item.id, - item: item, - className: Object(external_wp_blocks_["getBlockMenuDefaultClassName"])(item.id), - onSelect: onSelect, - onHover: onHover, - isDraggable: isDraggable, - isFirst: i === 0 && j === 0 - })))), children); -} - -/* harmony default export */ var block_types_list = (BlockTypesList); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/panel.js - - -/** - * WordPress dependencies - */ - - -function InserterPanel({ - title, - icon, - children -}) { - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-inserter__panel-header" - }, Object(external_wp_element_["createElement"])("h2", { - className: "block-editor-inserter__panel-title" - }, title), Object(external_wp_element_["createElement"])(external_wp_components_["Icon"], { - icon: icon - })), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-inserter__panel-content" - }, children)); -} - -/* harmony default export */ var panel = (InserterPanel); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/index.js - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - - - - - -function InserterListbox({ - children -}) { - const compositeState = Object(external_wp_components_["__unstableUseCompositeState"])({ - shift: true, - wrap: 'horizontal' - }); - return Object(external_wp_element_["createElement"])(inserter_listbox_context.Provider, { - value: compositeState - }, children); -} - -/* harmony default export */ var inserter_listbox = (InserterListbox); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-types-tab.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - - - - -const getBlockNamespace = item => item.name.split('/')[0]; - -const MAX_SUGGESTED_ITEMS = 6; -function BlockTypesTab({ - rootClientId, - onInsert, - onHover, - showMostUsedBlocks -}) { - const [items, categories, collections, onSelectItem] = use_block_types_state(rootClientId, onInsert); - const suggestedItems = Object(external_wp_element_["useMemo"])(() => { - return Object(external_lodash_["orderBy"])(items, ['frecency'], ['desc']).slice(0, MAX_SUGGESTED_ITEMS); - }, [items]); - const uncategorizedItems = Object(external_wp_element_["useMemo"])(() => { - return items.filter(item => !item.category); - }, [items]); - const itemsPerCategory = Object(external_wp_element_["useMemo"])(() => { - return Object(external_lodash_["flow"])(itemList => itemList.filter(item => item.category && item.category !== 'reusable'), itemList => Object(external_lodash_["groupBy"])(itemList, 'category'))(items); - }, [items]); - const itemsPerCollection = Object(external_wp_element_["useMemo"])(() => { - // Create a new Object to avoid mutating collection. - const result = { ...collections - }; - Object.keys(collections).forEach(namespace => { - result[namespace] = items.filter(item => getBlockNamespace(item) === namespace); - - if (result[namespace].length === 0) { - delete result[namespace]; - } - }); - return result; - }, [items, collections]); // Hide block preview on unmount. - - Object(external_wp_element_["useEffect"])(() => () => onHover(null), []); - return Object(external_wp_element_["createElement"])(inserter_listbox, null, Object(external_wp_element_["createElement"])("div", null, showMostUsedBlocks && !!suggestedItems.length && Object(external_wp_element_["createElement"])(panel, { - title: Object(external_wp_i18n_["_x"])('Most used', 'blocks') - }, Object(external_wp_element_["createElement"])(block_types_list, { - items: suggestedItems, - onSelect: onSelectItem, - onHover: onHover, - label: Object(external_wp_i18n_["_x"])('Most used', 'blocks') - })), Object(external_lodash_["map"])(categories, category => { - const categoryItems = itemsPerCategory[category.slug]; - - if (!categoryItems || !categoryItems.length) { - return null; - } - - return Object(external_wp_element_["createElement"])(panel, { - key: category.slug, - title: category.title, - icon: category.icon - }, Object(external_wp_element_["createElement"])(block_types_list, { - items: categoryItems, - onSelect: onSelectItem, - onHover: onHover, - label: category.title - })); - }), uncategorizedItems.length > 0 && Object(external_wp_element_["createElement"])(panel, { - className: "block-editor-inserter__uncategorized-blocks-panel", - title: Object(external_wp_i18n_["__"])('Uncategorized') - }, Object(external_wp_element_["createElement"])(block_types_list, { - items: uncategorizedItems, - onSelect: onSelectItem, - onHover: onHover, - label: Object(external_wp_i18n_["__"])('Uncategorized') - })), Object(external_lodash_["map"])(collections, (collection, namespace) => { - const collectionItems = itemsPerCollection[namespace]; - - if (!collectionItems || !collectionItems.length) { - return null; - } - - return Object(external_wp_element_["createElement"])(panel, { - key: namespace, - title: collection.title, - icon: collection.icon - }, Object(external_wp_element_["createElement"])(block_types_list, { - items: collectionItems, - onSelect: onSelectItem, - onHover: onHover, - label: collection.title - })); - }))); -} -/* harmony default export */ var block_types_tab = (BlockTypesTab); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/pattern-panel.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - -function PatternInserterPanel({ - selectedCategory, - patternCategories, - onClickCategory, - children -}) { - const categoryOptions = () => { - const options = []; - patternCategories.map(patternCategory => { - return options.push({ - value: patternCategory.name, - label: patternCategory.label - }); - }); - return options; - }; - - const onChangeSelect = selected => { - onClickCategory(patternCategories.find(patternCategory => selected === patternCategory.name)); - }; - - const getPanelHeaderClassName = () => { - return classnames_default()('block-editor-inserter__panel-header', 'block-editor-inserter__panel-header-patterns'); - }; // In iOS-based mobile devices, the onBlur will fire when selecting an option - // from a Select element. To prevent closing the useDialog on iOS devices, we - // stop propagating the onBlur event if there is no relatedTarget, which means - // that the user most likely did not click on an element within the editor canvas. - - - const onBlur = event => { - if (!(event !== null && event !== void 0 && event.relatedTarget)) { - event.stopPropagation(); - } - }; - - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { - className: getPanelHeaderClassName() - }, Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], { - className: "block-editor-inserter__panel-dropdown", - label: Object(external_wp_i18n_["__"])('Filter patterns'), - hideLabelFromVision: true, - value: selectedCategory.name, - onChange: onChangeSelect, - onBlur: onBlur, - options: categoryOptions() - })), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-inserter__panel-content" - }, children)); -} - -/* harmony default export */ var pattern_panel = (PatternInserterPanel); - -// EXTERNAL MODULE: external ["wp","notices"] -var external_wp_notices_ = __webpack_require__("onLe"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-patterns-state.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - -/** - * Retrieves the block patterns inserter state. - * - * @param {Function} onInsert function called when inserter a list of blocks. - * @param {string=} rootClientId Insertion's root client ID. - * - * @return {Array} Returns the patterns state. (patterns, categories, onSelect handler) - */ - -const usePatternsState = (onInsert, rootClientId) => { - const { - patternCategories, - patterns - } = Object(external_wp_data_["useSelect"])(select => { - const { - __experimentalGetAllowedPatterns, - getSettings - } = select(store); - return { - patterns: __experimentalGetAllowedPatterns(rootClientId), - patternCategories: getSettings().__experimentalBlockPatternCategories - }; - }, [rootClientId]); - const { - createSuccessNotice - } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]); - const onClickPattern = Object(external_wp_element_["useCallback"])((pattern, blocks) => { - onInsert(Object(external_lodash_["map"])(blocks, block => Object(external_wp_blocks_["cloneBlock"])(block)), pattern.name); - createSuccessNotice(Object(external_wp_i18n_["sprintf"])( - /* translators: %s: block pattern title. */ - Object(external_wp_i18n_["__"])('Block pattern "%s" inserted.'), pattern.title), { - type: 'snackbar' - }); - }, []); - return [patterns, patternCategories, onClickPattern]; -}; - -/* harmony default export */ var use_patterns_state = (usePatternsState); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-patterns-list/index.js - - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - - -function BlockPattern({ - isDraggable, - pattern, - onClick, - composite -}) { - const { - name, - viewportWidth - } = pattern; - const { - blocks - } = Object(external_wp_data_["useSelect"])(select => select(store).__experimentalGetParsedPattern(name), [name]); - const instanceId = Object(external_wp_compose_["useInstanceId"])(BlockPattern); - const descriptionId = `block-editor-block-patterns-list__item-description-${instanceId}`; - return Object(external_wp_element_["createElement"])(inserter_draggable_blocks, { - isEnabled: isDraggable, - blocks: blocks - }, ({ - draggable, - onDragStart, - onDragEnd - }) => Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-patterns-list__list-item", - "aria-label": pattern.title, - "aria-describedby": pattern.description ? descriptionId : undefined, - draggable: draggable, - onDragStart: onDragStart, - onDragEnd: onDragEnd - }, Object(external_wp_element_["createElement"])(external_wp_components_["__unstableCompositeItem"], Object(esm_extends["a" /* default */])({ - role: "option", - as: "div" - }, composite, { - className: "block-editor-block-patterns-list__item", - onClick: () => onClick(pattern, blocks) - }), Object(external_wp_element_["createElement"])(block_preview, { - blocks: blocks, - viewportWidth: viewportWidth - }), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-patterns-list__item-title" - }, pattern.title), !!pattern.description && Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { - id: descriptionId - }, pattern.description)))); -} - -function BlockPatternPlaceholder() { - return Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-patterns-list__item is-placeholder" - }); -} - -function BlockPatternList({ - isDraggable, - blockPatterns, - shownPatterns, - onClickPattern, - orientation, - label = Object(external_wp_i18n_["__"])('Block Patterns') -}) { - const composite = Object(external_wp_components_["__unstableUseCompositeState"])({ - orientation - }); - return Object(external_wp_element_["createElement"])(external_wp_components_["__unstableComposite"], Object(esm_extends["a" /* default */])({}, composite, { - role: "listbox", - className: "block-editor-block-patterns-list", - "aria-label": label - }), blockPatterns.map(pattern => { - const isShown = shownPatterns.includes(pattern); - return isShown ? Object(external_wp_element_["createElement"])(BlockPattern, { - key: pattern.name, - pattern: pattern, - onClick: onClickPattern, - isDraggable: isDraggable, - composite: composite - }) : Object(external_wp_element_["createElement"])(BlockPatternPlaceholder, { - key: pattern.name - }); - })); -} - -/* harmony default export */ var block_patterns_list = (BlockPatternList); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - - -function BlockPatternsCategory({ - rootClientId, - onInsert, - selectedCategory, - onClickCategory -}) { - const [allPatterns, allCategories, onClick] = use_patterns_state(onInsert, rootClientId); // Remove any empty categories - - const populatedCategories = Object(external_wp_element_["useMemo"])(() => allCategories.filter(category => allPatterns.some(pattern => { - var _pattern$categories; - - return (_pattern$categories = pattern.categories) === null || _pattern$categories === void 0 ? void 0 : _pattern$categories.includes(category.name); - })), [allPatterns, allCategories]); - const patternCategory = selectedCategory ? selectedCategory : populatedCategories[0]; - Object(external_wp_element_["useEffect"])(() => { - if (allPatterns.some(pattern => getPatternIndex(pattern) === Infinity) && !populatedCategories.find(category => category.name === 'uncategorized')) { - populatedCategories.push({ - name: 'uncategorized', - label: Object(external_wp_i18n_["_x"])('Uncategorized') - }); - } - }, [populatedCategories, allPatterns]); - const getPatternIndex = Object(external_wp_element_["useCallback"])(pattern => { - if (!pattern.categories || !pattern.categories.length) { - return Infinity; - } - - const indexedCategories = Object(external_lodash_["fromPairs"])(populatedCategories.map(({ - name - }, index) => [name, index])); - return Math.min(...pattern.categories.map(cat => indexedCategories[cat] !== undefined ? indexedCategories[cat] : Infinity)); - }, [populatedCategories]); - const currentCategoryPatterns = Object(external_wp_element_["useMemo"])(() => allPatterns.filter(pattern => patternCategory.name === 'uncategorized' ? getPatternIndex(pattern) === Infinity : pattern.categories && pattern.categories.includes(patternCategory.name)), [allPatterns, patternCategory]); // Ordering the patterns is important for the async rendering. - - const orderedPatterns = Object(external_wp_element_["useMemo"])(() => { - return currentCategoryPatterns.sort((a, b) => { - return getPatternIndex(a) - getPatternIndex(b); - }); - }, [currentCategoryPatterns, getPatternIndex]); - const currentShownPatterns = Object(external_wp_compose_["useAsyncList"])(orderedPatterns); - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, !!currentCategoryPatterns.length && Object(external_wp_element_["createElement"])(pattern_panel, { - selectedCategory: patternCategory, - patternCategories: populatedCategories, - onClickCategory: onClickCategory - }, Object(external_wp_element_["createElement"])(block_patterns_list, { - shownPatterns: currentShownPatterns, - blockPatterns: currentCategoryPatterns, - onClickPattern: onClick, - label: patternCategory.label, - orientation: "vertical", - isDraggable: true - }))); -} - -function BlockPatternsTabs({ - rootClientId, - onInsert, - onClickCategory, - selectedCategory -}) { - return Object(external_wp_element_["createElement"])(BlockPatternsCategory, { - rootClientId: rootClientId, - selectedCategory: selectedCategory, - onInsert: onInsert, - onClickCategory: onClickCategory - }); -} - -/* harmony default export */ var block_patterns_tab = (BlockPatternsTabs); - -// EXTERNAL MODULE: external ["wp","url"] -var external_wp_url_ = __webpack_require__("Mmq9"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/no-results.js - - -/** - * WordPress dependencies - */ - - - -function InserterNoResults() { - return Object(external_wp_element_["createElement"])("div", { - className: "block-editor-inserter__no-results" - }, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { - className: "block-editor-inserter__no-results-icon", - icon: block_default["a" /* default */] - }), Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('No results found.'))); -} - -/* harmony default export */ var no_results = (InserterNoResults); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/reusable-blocks-tab.js - - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - - - - -function ReusableBlocksList({ - onHover, - onInsert, - rootClientId -}) { - const [items,,, onSelectItem] = use_block_types_state(rootClientId, onInsert); - const filteredItems = Object(external_wp_element_["useMemo"])(() => { - return items.filter(({ - category - }) => category === 'reusable'); - }, [items]); - - if (filteredItems.length === 0) { - return Object(external_wp_element_["createElement"])(no_results, null); - } - - return Object(external_wp_element_["createElement"])(panel, { - title: Object(external_wp_i18n_["__"])('Reusable blocks') - }, Object(external_wp_element_["createElement"])(block_types_list, { - items: filteredItems, - onSelect: onSelectItem, - onHover: onHover, - label: Object(external_wp_i18n_["__"])('Reusable blocks') - })); -} // The unwrapped component is only exported for use by unit tests. - -/** - * List of reusable blocks shown in the "Reusable" tab of the inserter. - * - * @param {Object} props Component props. - * @param {?string} props.rootClientId Client id of block to insert into. - * @param {Function} props.onInsert Callback to run when item is inserted. - * @param {Function} props.onHover Callback to run when item is hovered. - * - * @return {WPComponent} The component. - */ - - -function ReusableBlocksTab({ - rootClientId, - onInsert, - onHover -}) { - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(ReusableBlocksList, { - onHover: onHover, - onInsert: onInsert, - rootClientId: rootClientId - }), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-inserter__manage-reusable-blocks-container" - }, Object(external_wp_element_["createElement"])("a", { - className: "block-editor-inserter__manage-reusable-blocks", - href: Object(external_wp_url_["addQueryArgs"])('edit.php', { - post_type: 'wp_block' - }) - }, Object(external_wp_i18n_["__"])('Manage Reusable blocks')))); -} -/* harmony default export */ var reusable_blocks_tab = (ReusableBlocksTab); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-menu-extension/index.js -/** - * WordPress dependencies - */ - -const { - Fill: __unstableInserterMenuExtension, - Slot: inserter_menu_extension_Slot -} = Object(external_wp_components_["createSlotFill"])('__unstableInserterMenuExtension'); -__unstableInserterMenuExtension.Slot = inserter_menu_extension_Slot; -/* harmony default export */ var inserter_menu_extension = (__unstableInserterMenuExtension); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-insertion-point.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - -/** - * @typedef WPInserterConfig - * - * @property {string=} rootClientId If set, insertion will be into the - * block with this ID. - * @property {number=} insertionIndex If set, insertion will be into this - * explicit position. - * @property {string=} clientId If set, insertion will be after the - * block with this ID. - * @property {boolean=} isAppender Whether the inserter is an appender - * or not. - * @property {Function=} onSelect Called after insertion. - */ - -/** - * Returns the insertion point state given the inserter config. - * - * @param {WPInserterConfig} config Inserter Config. - * @return {Array} Insertion Point State (rootClientID, onInsertBlocks and onToggle). - */ - -function useInsertionPoint({ - rootClientId = '', - insertionIndex, - clientId, - isAppender, - onSelect, - shouldFocusBlock = true -}) { - const { - getSelectedBlock - } = Object(external_wp_data_["useSelect"])(store); - const { - destinationRootClientId, - destinationIndex - } = Object(external_wp_data_["useSelect"])(select => { - const { - getSelectedBlockClientId, - getBlockRootClientId, - getBlockIndex, - getBlockOrder - } = select(store); - const selectedBlockClientId = getSelectedBlockClientId(); - let _destinationRootClientId = rootClientId; - - let _destinationIndex; - - if (insertionIndex !== undefined) { - // Insert into a specific index. - _destinationIndex = insertionIndex; - } else if (clientId) { - // Insert after a specific client ID. - _destinationIndex = getBlockIndex(clientId, _destinationRootClientId); - } else if (!isAppender && selectedBlockClientId) { - _destinationRootClientId = getBlockRootClientId(selectedBlockClientId); - _destinationIndex = getBlockIndex(selectedBlockClientId, _destinationRootClientId) + 1; - } else { - // Insert at the end of the list. - _destinationIndex = getBlockOrder(_destinationRootClientId).length; - } - - return { - destinationRootClientId: _destinationRootClientId, - destinationIndex: _destinationIndex - }; - }, [rootClientId, insertionIndex, clientId, isAppender]); - const { - replaceBlocks, - insertBlocks, - showInsertionPoint, - hideInsertionPoint - } = Object(external_wp_data_["useDispatch"])(store); - const onInsertBlocks = Object(external_wp_element_["useCallback"])((blocks, meta, shouldForceFocusBlock = false) => { - const selectedBlock = getSelectedBlock(); - - if (!isAppender && selectedBlock && Object(external_wp_blocks_["isUnmodifiedDefaultBlock"])(selectedBlock)) { - replaceBlocks(selectedBlock.clientId, blocks, null, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta); - } else { - insertBlocks(blocks, destinationIndex, destinationRootClientId, true, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta); - } - - const message = Object(external_wp_i18n_["sprintf"])( // translators: %d: the name of the block that has been added - Object(external_wp_i18n_["_n"])('%d block added.', '%d blocks added.', Object(external_lodash_["castArray"])(blocks).length), Object(external_lodash_["castArray"])(blocks).length); - Object(external_wp_a11y_["speak"])(message); - - if (onSelect) { - onSelect(); - } - }, [isAppender, getSelectedBlock, replaceBlocks, insertBlocks, destinationRootClientId, destinationIndex, onSelect, shouldFocusBlock]); - const onToggleInsertionPoint = Object(external_wp_element_["useCallback"])(show => { - if (show) { - showInsertionPoint(destinationRootClientId, destinationIndex); - } else { - hideInsertionPoint(); - } - }, [showInsertionPoint, hideInsertionPoint, destinationRootClientId, destinationIndex]); - return [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint]; -} - -/* harmony default export */ var use_insertion_point = (useInsertionPoint); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/search-results.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - - - - - - - - - - -function InserterSearchResults({ - filterValue, - onSelect, - onHover, - rootClientId, - clientId, - isAppender, - __experimentalInsertionIndex, - maxBlockPatterns, - maxBlockTypes, - showBlockDirectory = false, - isDraggable = true, - shouldFocusBlock = true -}) { - const debouncedSpeak = Object(external_wp_compose_["useDebounce"])(external_wp_a11y_["speak"], 500); - const [destinationRootClientId, onInsertBlocks] = use_insertion_point({ - onSelect, - rootClientId, - clientId, - isAppender, - insertionIndex: __experimentalInsertionIndex, - shouldFocusBlock - }); - const [blockTypes, blockTypeCategories, blockTypeCollections, onSelectBlockType] = use_block_types_state(destinationRootClientId, onInsertBlocks); - const [patterns,, onSelectBlockPattern] = use_patterns_state(onInsertBlocks, destinationRootClientId); - const filteredBlockTypes = Object(external_wp_element_["useMemo"])(() => { - const results = searchBlockItems(Object(external_lodash_["orderBy"])(blockTypes, ['frecency'], ['desc']), blockTypeCategories, blockTypeCollections, filterValue); - return maxBlockTypes !== undefined ? results.slice(0, maxBlockTypes) : results; - }, [filterValue, blockTypes, blockTypeCategories, blockTypeCollections, maxBlockTypes]); - const filteredBlockPatterns = Object(external_wp_element_["useMemo"])(() => { - const results = searchItems(patterns, filterValue); - return maxBlockPatterns !== undefined ? results.slice(0, maxBlockPatterns) : results; - }, [filterValue, patterns, maxBlockPatterns]); // Announce search results on change - - Object(external_wp_element_["useEffect"])(() => { - if (!filterValue) { - return; - } - - const count = filteredBlockTypes.length + filteredBlockPatterns.length; - const resultsFoundMessage = Object(external_wp_i18n_["sprintf"])( - /* translators: %d: number of results. */ - Object(external_wp_i18n_["_n"])('%d result found.', '%d results found.', count), count); - debouncedSpeak(resultsFoundMessage); - }, [filterValue, debouncedSpeak]); - const currentShownPatterns = Object(external_wp_compose_["useAsyncList"])(filteredBlockPatterns); - const hasItems = !Object(external_lodash_["isEmpty"])(filteredBlockTypes) || !Object(external_lodash_["isEmpty"])(filteredBlockPatterns); - return Object(external_wp_element_["createElement"])(inserter_listbox, null, !showBlockDirectory && !hasItems && Object(external_wp_element_["createElement"])(no_results, null), !!filteredBlockTypes.length && Object(external_wp_element_["createElement"])(panel, { - title: Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], null, Object(external_wp_i18n_["__"])('Blocks')) - }, Object(external_wp_element_["createElement"])(block_types_list, { - items: filteredBlockTypes, - onSelect: onSelectBlockType, - onHover: onHover, - label: Object(external_wp_i18n_["__"])('Blocks'), - isDraggable: isDraggable - })), !!filteredBlockTypes.length && !!filteredBlockPatterns.length && Object(external_wp_element_["createElement"])("div", { - className: "block-editor-inserter__quick-inserter-separator" - }), !!filteredBlockPatterns.length && Object(external_wp_element_["createElement"])(panel, { - title: Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], null, Object(external_wp_i18n_["__"])('Block Patterns')) - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-inserter__quick-inserter-patterns" - }, Object(external_wp_element_["createElement"])(block_patterns_list, { - shownPatterns: currentShownPatterns, - blockPatterns: filteredBlockPatterns, - onClickPattern: onSelectBlockPattern, - isDraggable: isDraggable - }))), showBlockDirectory && Object(external_wp_element_["createElement"])(inserter_menu_extension.Slot, { - fillProps: { - onSelect: onSelectBlockType, - onHover, - filterValue, - hasItems, - rootClientId: destinationRootClientId - } - }, fills => { - if (fills.length) { - return fills; - } - - if (!hasItems) { - return Object(external_wp_element_["createElement"])(no_results, null); - } - - return null; - })); -} - -/* harmony default export */ var search_results = (InserterSearchResults); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/tabs.js - - -/** - * WordPress dependencies - */ - - - -const tabs_blocksTab = { - name: 'blocks', - - /* translators: Blocks tab title in the block inserter. */ - title: Object(external_wp_i18n_["__"])('Blocks') -}; -const tabs_patternsTab = { - name: 'patterns', - - /* translators: Patterns tab title in the block inserter. */ - title: Object(external_wp_i18n_["__"])('Patterns') -}; -const tabs_reusableBlocksTab = { - name: 'reusable', - - /* translators: Reusable blocks tab title in the block inserter. */ - title: Object(external_wp_i18n_["__"])('Reusable') -}; - -function InserterTabs({ - children, - showPatterns = false, - showReusableBlocks = false, - onSelect -}) { - const tabs = Object(external_wp_element_["useMemo"])(() => { - const tempTabs = [tabs_blocksTab]; - - if (showPatterns) { - tempTabs.push(tabs_patternsTab); - } - - if (showReusableBlocks) { - tempTabs.push(tabs_reusableBlocksTab); - } - - return tempTabs; - }, [tabs_blocksTab, showPatterns, tabs_patternsTab, showReusableBlocks, tabs_reusableBlocksTab]); - return Object(external_wp_element_["createElement"])(external_wp_components_["TabPanel"], { - className: "block-editor-inserter__tabs", - tabs: tabs, - onSelect: onSelect - }, children); -} - -/* harmony default export */ var inserter_tabs = (InserterTabs); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/menu.js - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - - - - - - - - - -function InserterMenu({ - rootClientId, - clientId, - isAppender, - __experimentalInsertionIndex, - onSelect, - showInserterHelpPanel, - showMostUsedBlocks, - shouldFocusBlock = true -}) { - const [filterValue, setFilterValue] = Object(external_wp_element_["useState"])(''); - const [hoveredItem, setHoveredItem] = Object(external_wp_element_["useState"])(null); - const [selectedPatternCategory, setSelectedPatternCategory] = Object(external_wp_element_["useState"])(null); - const [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint] = use_insertion_point({ - rootClientId, - clientId, - isAppender, - insertionIndex: __experimentalInsertionIndex, - shouldFocusBlock - }); - const { - showPatterns, - hasReusableBlocks - } = Object(external_wp_data_["useSelect"])(select => { - var _getSettings$__experi; - - const { - __experimentalGetAllowedPatterns, - getSettings - } = select(store); - return { - showPatterns: !!__experimentalGetAllowedPatterns(destinationRootClientId).length, - hasReusableBlocks: !!((_getSettings$__experi = getSettings().__experimentalReusableBlocks) !== null && _getSettings$__experi !== void 0 && _getSettings$__experi.length) - }; - }, [destinationRootClientId]); - const onInsert = Object(external_wp_element_["useCallback"])((blocks, meta, shouldForceFocusBlock) => { - onInsertBlocks(blocks, meta, shouldForceFocusBlock); - onSelect(); - }, [onInsertBlocks, onSelect]); - const onInsertPattern = Object(external_wp_element_["useCallback"])((blocks, patternName) => { - onInsertBlocks(blocks, { - patternName - }); - onSelect(); - }, [onInsertBlocks, onSelect]); - const onHover = Object(external_wp_element_["useCallback"])(item => { - onToggleInsertionPoint(!!item); - setHoveredItem(item); - }, [onToggleInsertionPoint, setHoveredItem]); - const onClickPatternCategory = Object(external_wp_element_["useCallback"])(patternCategory => { - setSelectedPatternCategory(patternCategory); - }, [setSelectedPatternCategory]); - const blocksTab = Object(external_wp_element_["useMemo"])(() => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-inserter__block-list" - }, Object(external_wp_element_["createElement"])(block_types_tab, { - rootClientId: destinationRootClientId, - onInsert: onInsert, - onHover: onHover, - showMostUsedBlocks: showMostUsedBlocks - })), showInserterHelpPanel && Object(external_wp_element_["createElement"])("div", { - className: "block-editor-inserter__tips" - }, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { - as: "h2" - }, Object(external_wp_i18n_["__"])('A tip for using the block editor')), Object(external_wp_element_["createElement"])(tips, null))), [destinationRootClientId, onInsert, onHover, filterValue, showMostUsedBlocks, showInserterHelpPanel]); - const patternsTab = Object(external_wp_element_["useMemo"])(() => Object(external_wp_element_["createElement"])(block_patterns_tab, { - rootClientId: destinationRootClientId, - onInsert: onInsertPattern, - onClickCategory: onClickPatternCategory, - selectedCategory: selectedPatternCategory - }), [destinationRootClientId, onInsertPattern, onClickPatternCategory, selectedPatternCategory]); - const reusableBlocksTab = Object(external_wp_element_["useMemo"])(() => Object(external_wp_element_["createElement"])(reusable_blocks_tab, { - rootClientId: destinationRootClientId, - onInsert: onInsert, - onHover: onHover - }), [destinationRootClientId, onInsert, onHover]); - const getCurrentTab = Object(external_wp_element_["useCallback"])(tab => { - if (tab.name === 'blocks') { - return blocksTab; - } else if (tab.name === 'patterns') { - return patternsTab; - } - - return reusableBlocksTab; - }, [blocksTab, patternsTab, reusableBlocksTab]); - return Object(external_wp_element_["createElement"])("div", { - className: "block-editor-inserter__menu" - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-inserter__main-area" - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-inserter__content" - }, Object(external_wp_element_["createElement"])(search_form, { - onChange: value => { - if (hoveredItem) setHoveredItem(null); - setFilterValue(value); - }, - value: filterValue, - label: Object(external_wp_i18n_["__"])('Search for blocks and patterns'), - placeholder: Object(external_wp_i18n_["__"])('Search') - }), !!filterValue && Object(external_wp_element_["createElement"])(search_results, { - filterValue: filterValue, - onSelect: onSelect, - onHover: onHover, - rootClientId: rootClientId, - clientId: clientId, - isAppender: isAppender, - __experimentalInsertionIndex: __experimentalInsertionIndex, - showBlockDirectory: true, - shouldFocusBlock: shouldFocusBlock - }), !filterValue && (showPatterns || hasReusableBlocks) && Object(external_wp_element_["createElement"])(inserter_tabs, { - showPatterns: showPatterns, - showReusableBlocks: hasReusableBlocks - }, getCurrentTab), !filterValue && !showPatterns && !hasReusableBlocks && blocksTab)), showInserterHelpPanel && hoveredItem && Object(external_wp_element_["createElement"])(preview_panel, { - item: hoveredItem - })); -} - -/* harmony default export */ var menu = (InserterMenu); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/quick-inserter.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - - - - - -const SEARCH_THRESHOLD = 6; -const quick_inserter_SHOWN_BLOCK_TYPES = 6; -const SHOWN_BLOCK_PATTERNS = 2; -function QuickInserter({ - onSelect, - rootClientId, - clientId, - isAppender -}) { - const [filterValue, setFilterValue] = Object(external_wp_element_["useState"])(''); - const [destinationRootClientId, onInsertBlocks] = use_insertion_point({ - onSelect, - rootClientId, - clientId, - isAppender - }); - const [blockTypes] = use_block_types_state(destinationRootClientId, onInsertBlocks); - const [patterns] = use_patterns_state(onInsertBlocks, destinationRootClientId); - const showPatterns = patterns.length && !!filterValue; - const showSearch = showPatterns && patterns.length > SEARCH_THRESHOLD || blockTypes.length > SEARCH_THRESHOLD; - const { - setInserterIsOpened, - insertionIndex - } = Object(external_wp_data_["useSelect"])(select => { - const { - getSettings, - getBlockIndex, - getBlockCount - } = select(store); - const index = getBlockIndex(clientId, rootClientId); - return { - setInserterIsOpened: getSettings().__experimentalSetIsInserterOpened, - insertionIndex: index === -1 ? getBlockCount() : index - }; - }, [clientId, rootClientId]); - Object(external_wp_element_["useEffect"])(() => { - if (setInserterIsOpened) { - setInserterIsOpened(false); - } - }, [setInserterIsOpened]); // When clicking Browse All select the appropriate block so as - // the insertion point can work as expected - - const onBrowseAll = () => { - setInserterIsOpened({ - rootClientId, - insertionIndex - }); - }; - - return Object(external_wp_element_["createElement"])("div", { - className: classnames_default()('block-editor-inserter__quick-inserter', { - 'has-search': showSearch, - 'has-expand': setInserterIsOpened - }) - }, showSearch && Object(external_wp_element_["createElement"])(search_form, { - value: filterValue, - onChange: value => { - setFilterValue(value); - }, - label: Object(external_wp_i18n_["__"])('Search for blocks and patterns'), - placeholder: Object(external_wp_i18n_["__"])('Search') - }), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-inserter__quick-inserter-results" - }, Object(external_wp_element_["createElement"])(search_results, { - filterValue: filterValue, - onSelect: onSelect, - rootClientId: rootClientId, - clientId: clientId, - isAppender: isAppender, - maxBlockPatterns: showPatterns ? SHOWN_BLOCK_PATTERNS : 0, - maxBlockTypes: quick_inserter_SHOWN_BLOCK_TYPES, - isDraggable: false - })), setInserterIsOpened && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - className: "block-editor-inserter__quick-inserter-expand", - onClick: onBrowseAll, - "aria-label": Object(external_wp_i18n_["__"])('Browse all. This will open the main inserter panel in the editor toolbar.') - }, Object(external_wp_i18n_["__"])('Browse all'))); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/index.js - - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - - - - - - -/** - * Internal dependencies - */ - - - - - -const defaultRenderToggle = ({ - onToggle, - disabled, - isOpen, - blockTitle, - hasSingleBlockType, - toggleProps = {} -}) => { - let label; - - if (hasSingleBlockType) { - label = Object(external_wp_i18n_["sprintf"])( // translators: %s: the name of the block when there is only one - Object(external_wp_i18n_["_x"])('Add %s', 'directly add the only allowed block'), blockTitle); - } else { - label = Object(external_wp_i18n_["_x"])('Add block', 'Generic label for block inserter button'); - } - - const { - onClick, - ...rest - } = toggleProps; // Handle both onClick functions from the toggle and the parent component - - function handleClick(event) { - if (onToggle) { - onToggle(event); - } - - if (onClick) { - onClick(event); - } - } - - return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({ - icon: plus["a" /* default */], - label: label, - tooltipPosition: "bottom", - onClick: handleClick, - className: "block-editor-inserter__toggle", - "aria-haspopup": !hasSingleBlockType ? 'true' : false, - "aria-expanded": !hasSingleBlockType ? isOpen : false, - disabled: disabled - }, rest)); -}; - -class inserter_Inserter extends external_wp_element_["Component"] { - constructor() { - super(...arguments); - this.onToggle = this.onToggle.bind(this); - this.renderToggle = this.renderToggle.bind(this); - this.renderContent = this.renderContent.bind(this); - } - - onToggle(isOpen) { - const { - onToggle - } = this.props; // Surface toggle callback to parent component - - if (onToggle) { - onToggle(isOpen); - } - } - /** - * Render callback to display Dropdown toggle element. - * - * @param {Object} options - * @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. - */ - - - renderToggle({ - onToggle, - isOpen - }) { - const { - disabled, - blockTitle, - hasSingleBlockType, - toggleProps, - hasItems, - renderToggle = defaultRenderToggle - } = this.props; - return renderToggle({ - onToggle, - isOpen, - disabled: disabled || !hasItems, - blockTitle, - hasSingleBlockType, - toggleProps - }); - } - /** - * Render callback to display Dropdown content element. - * - * @param {Object} options - * @param {Function} options.onClose Callback to invoke when dropdown is - * closed. - * - * @return {WPElement} Dropdown content element. - */ - - - renderContent({ - onClose - }) { - const { - rootClientId, - clientId, - isAppender, - showInserterHelpPanel, - // This prop is experimental to give some time for the quick inserter to mature - // Feel free to make them stable after a few releases. - __experimentalIsQuick: isQuick - } = this.props; - - if (isQuick) { - return Object(external_wp_element_["createElement"])(QuickInserter, { - onSelect: () => { - onClose(); - }, - rootClientId: rootClientId, - clientId: clientId, - isAppender: isAppender - }); - } - - return Object(external_wp_element_["createElement"])(menu, { - onSelect: () => { - onClose(); - }, - rootClientId: rootClientId, - clientId: clientId, - isAppender: isAppender, - showInserterHelpPanel: showInserterHelpPanel - }); - } - - render() { - const { - position, - hasSingleBlockType, - insertOnlyAllowedBlock, - __experimentalIsQuick: isQuick, - onSelectOrClose - } = this.props; - - if (hasSingleBlockType) { - return this.renderToggle({ - onToggle: insertOnlyAllowedBlock - }); - } - - return Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], { - className: "block-editor-inserter", - contentClassName: classnames_default()('block-editor-inserter__popover', { - 'is-quick': isQuick - }), - position: position, - onToggle: this.onToggle, - expandOnMobile: true, - headerTitle: Object(external_wp_i18n_["__"])('Add a block'), - renderToggle: this.renderToggle, - renderContent: this.renderContent, - onClose: onSelectOrClose - }); - } - -} - -/* harmony default export */ var inserter = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, { - clientId, - rootClientId -}) => { - const { - getBlockRootClientId, - hasInserterItems, - __experimentalGetAllowedBlocks - } = select(store); - const { - getBlockVariations - } = select(external_wp_blocks_["store"]); - rootClientId = rootClientId || getBlockRootClientId(clientId) || undefined; - - const allowedBlocks = __experimentalGetAllowedBlocks(rootClientId); - - const hasSingleBlockType = Object(external_lodash_["size"])(allowedBlocks) === 1 && Object(external_lodash_["size"])(getBlockVariations(allowedBlocks[0].name, 'inserter')) === 0; - let allowedBlockType = false; - - if (hasSingleBlockType) { - allowedBlockType = allowedBlocks[0]; - } - - return { - hasItems: hasInserterItems(rootClientId), - hasSingleBlockType, - blockTitle: allowedBlockType ? allowedBlockType.title : '', - allowedBlockType, - rootClientId - }; -}), Object(external_wp_data_["withDispatch"])((dispatch, ownProps, { - select -}) => { - return { - insertOnlyAllowedBlock() { - const { - rootClientId, - clientId, - isAppender, - hasSingleBlockType, - allowedBlockType, - onSelectOrClose - } = ownProps; - - if (!hasSingleBlockType) { - return; - } - - function getInsertionIndex() { - const { - getBlockIndex, - getBlockSelectionEnd, - getBlockOrder, - getBlockRootClientId - } = select(store); // If the clientId is defined, we insert at the position of the block. - - if (clientId) { - return getBlockIndex(clientId, rootClientId); - } // If there a selected block, we insert after the selected block. - - - const end = getBlockSelectionEnd(); - - if (!isAppender && end && getBlockRootClientId(end) === rootClientId) { - return getBlockIndex(end, rootClientId) + 1; - } // Otherwise, we insert at the end of the current rootClientId - - - return getBlockOrder(rootClientId).length; - } - - const { - insertBlock - } = dispatch(store); - const blockToInsert = Object(external_wp_blocks_["createBlock"])(allowedBlockType.name); - insertBlock(blockToInsert, getInsertionIndex(), rootClientId); - - if (onSelectOrClose) { - onSelectOrClose(); - } - - const message = Object(external_wp_i18n_["sprintf"])( // translators: %s: the name of the block that has been added - Object(external_wp_i18n_["__"])('%s block added'), allowedBlockType.title); - Object(external_wp_a11y_["speak"])(message); - } - - }; -}), // The global inserter should always be visible, we are using ( ! isAppender && ! rootClientId && ! clientId ) as -// a way to detect the global Inserter. -Object(external_wp_compose_["ifCondition"])(({ - hasItems, - isAppender, - rootClientId, - clientId -}) => hasItems || !isAppender && !rootClientId && !clientId)])(inserter_Inserter)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/default-block-appender/index.js - - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - -/** - * Zero width non-breaking space, used as padding for the paragraph when it is - * empty. - */ - -const ZWNBSP = '\ufeff'; -function DefaultBlockAppender({ - isLocked, - isVisible, - onAppend, - showPrompt, - placeholder, - rootClientId -}) { - if (isLocked || !isVisible) { - return null; - } - - const value = Object(external_wp_htmlEntities_["decodeEntities"])(placeholder) || Object(external_wp_i18n_["__"])('Type / to choose a block'); - - return Object(external_wp_element_["createElement"])("div", { - "data-root-client-id": rootClientId || '', - className: "block-editor-default-block-appender" - }, Object(external_wp_element_["createElement"])("p", { - tabIndex: "0" // Only necessary for `useCanvasClickRedirect` to consider it - // as a target. Ideally it should consider any tabbable target, - // but the inserter is rendered in place while it should be - // rendered in a popover, just like it does for an empty - // paragraph block. - , - contentEditable: true, - suppressContentEditableWarning: true // We want this element to be styled as a paragraph by themes. - // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role - , - role: "button", - "aria-label": Object(external_wp_i18n_["__"])('Add block') // The wp-block className is important for editor styles. - , - className: "wp-block block-editor-default-block-appender__content", - onFocus: onAppend - }, showPrompt ? value : ZWNBSP), Object(external_wp_element_["createElement"])(inserter, { - rootClientId: rootClientId, - position: "bottom right", - isAppender: true, - __experimentalIsQuick: true - })); -} -/* harmony default export */ var default_block_appender = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])((select, ownProps) => { - const { - getBlockCount, - getBlockName, - isBlockValid, - getSettings, - getTemplateLock - } = select(store); - const isEmpty = !getBlockCount(ownProps.rootClientId); - const isLastBlockDefault = getBlockName(ownProps.lastBlockClientId) === Object(external_wp_blocks_["getDefaultBlockName"])(); - const isLastBlockValid = isBlockValid(ownProps.lastBlockClientId); - const { - bodyPlaceholder - } = getSettings(); - return { - isVisible: isEmpty || !isLastBlockDefault || !isLastBlockValid, - showPrompt: isEmpty, - isLocked: !!getTemplateLock(ownProps.rootClientId), - placeholder: bodyPlaceholder - }; -}), Object(external_wp_data_["withDispatch"])((dispatch, ownProps) => { - const { - insertDefaultBlock, - startTyping - } = dispatch(store); - return { - onAppend() { - const { - rootClientId - } = ownProps; - insertDefaultBlock(undefined, rootClientId); - startTyping(); - } - - }; -}))(DefaultBlockAppender)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/button-block-appender/index.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - -function ButtonBlockAppender({ - rootClientId, - className, - onFocus, - tabIndex -}, ref) { - return Object(external_wp_element_["createElement"])(inserter, { - position: "bottom center", - rootClientId: rootClientId, - __experimentalIsQuick: true, - renderToggle: ({ - onToggle, - disabled, - isOpen, - blockTitle, - hasSingleBlockType - }) => { - let label; - - if (hasSingleBlockType) { - label = Object(external_wp_i18n_["sprintf"])( // translators: %s: the name of the block when there is only one - Object(external_wp_i18n_["_x"])('Add %s', 'directly add the only allowed block'), blockTitle); - } else { - label = Object(external_wp_i18n_["_x"])('Add block', 'Generic label for block inserter button'); - } - - const isToggleButton = !hasSingleBlockType; - let inserterButton = Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - ref: ref, - onFocus: onFocus, - tabIndex: tabIndex, - className: classnames_default()(className, 'block-editor-button-block-appender'), - onClick: onToggle, - "aria-haspopup": isToggleButton ? 'true' : undefined, - "aria-expanded": isToggleButton ? isOpen : undefined, - disabled: disabled, - label: label - }, !hasSingleBlockType && Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { - as: "span" - }, label), Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { - icon: plus["a" /* default */] - })); - - if (isToggleButton || hasSingleBlockType) { - inserterButton = Object(external_wp_element_["createElement"])(external_wp_components_["Tooltip"], { - text: label - }, inserterButton); - } - - return inserterButton; - }, - isAppender: true - }); -} -/** - * Use `ButtonBlockAppender` instead. - * - * @deprecated - */ - - -const ButtonBlockerAppender = Object(external_wp_element_["forwardRef"])((props, ref) => { - external_wp_deprecated_default()(`wp.blockEditor.ButtonBlockerAppender`, { - alternative: 'wp.blockEditor.ButtonBlockAppender' - }); - return ButtonBlockAppender(props, ref); -}); -/** - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/button-block-appender/README.md - */ - -/* harmony default export */ var button_block_appender = (Object(external_wp_element_["forwardRef"])(ButtonBlockAppender)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list-appender/index.js - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - // A Context to store the map of the appender map. - -const AppenderNodesContext = Object(external_wp_element_["createContext"])(); - -function stopPropagation(event) { - event.stopPropagation(); -} - -function BlockListAppender({ - blockClientIds, - rootClientId, - canInsertDefaultBlock, - isLocked, - renderAppender: CustomAppender, - className, - selectedBlockClientId, - tagName: TagName = 'div' -}) { - if (isLocked || CustomAppender === false) { - return null; - } - - let appender; - - if (CustomAppender) { - // Prefer custom render prop if provided. - appender = Object(external_wp_element_["createElement"])(CustomAppender, null); - } else { - const isDocumentAppender = !rootClientId; - const isParentSelected = selectedBlockClientId === rootClientId; - const isAnotherDefaultAppenderAlreadyDisplayed = selectedBlockClientId && !blockClientIds.includes(selectedBlockClientId); - - if (!isDocumentAppender && !isParentSelected && (!selectedBlockClientId || isAnotherDefaultAppenderAlreadyDisplayed)) { - return null; - } - - if (canInsertDefaultBlock) { - // Render the default block appender when renderAppender has not been - // provided and the context supports use of the default appender. - appender = Object(external_wp_element_["createElement"])(default_block_appender, { - rootClientId: rootClientId, - lastBlockClientId: Object(external_lodash_["last"])(blockClientIds) - }); - } else { - // Fallback in the case no renderAppender has been provided and the - // default block can't be inserted. - appender = Object(external_wp_element_["createElement"])(button_block_appender, { - rootClientId: rootClientId, - className: "block-list-appender__toggle" - }); - } - } - - return Object(external_wp_element_["createElement"])(TagName // A `tabIndex` is used on the wrapping `div` element in order to - // force a focus event to occur when an appender `button` element - // is clicked. In some browsers (Firefox, Safari), button clicks do - // not emit a focus event, which could cause this event to propagate - // unexpectedly. The `tabIndex` ensures that the interaction is - // captured as a focus, without also adding an extra tab stop. - // - // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus - , { - tabIndex: -1 // Prevent the block from being selected when the appender is - // clicked. - , - onFocus: stopPropagation, - className: classnames_default()('block-list-appender', className) - }, appender); -} - -/* harmony default export */ var block_list_appender = (Object(external_wp_data_["withSelect"])((select, { - rootClientId -}) => { - const { - getBlockOrder, - canInsertBlockType, - getTemplateLock, - getSelectedBlockClientId - } = select(store); - return { - isLocked: !!getTemplateLock(rootClientId), - blockClientIds: getBlockOrder(rootClientId), - canInsertDefaultBlock: canInsertBlockType(Object(external_wp_blocks_["getDefaultBlockName"])(), rootClientId), - selectedBlockClientId: getSelectedBlockClientId() - }; -})(BlockListAppender)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-on-block-drop/index.js -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - -/** @typedef {import('@wordpress/element').WPSyntheticEvent} WPSyntheticEvent */ - -/** - * Retrieve the data for a block drop event. - * - * @param {WPSyntheticEvent} event The drop event. - * - * @return {Object} An object with block drag and drop data. - */ - -function parseDropEvent(event) { - let result = { - srcRootClientId: null, - srcClientIds: null, - srcIndex: null, - type: null, - blocks: null - }; - - if (!event.dataTransfer) { - return result; - } - - try { - result = Object.assign(result, JSON.parse(event.dataTransfer.getData('wp-blocks'))); - } catch (err) { - return result; - } - - return result; -} -/** - * A function that returns an event handler function for block drop events. - * - * @param {string} targetRootClientId The root client id where the block(s) will be inserted. - * @param {number} targetBlockIndex The index where the block(s) will be inserted. - * @param {Function} getBlockIndex A function that gets the index of a block. - * @param {Function} getClientIdsOfDescendants A function that gets the client ids of descendant blocks. - * @param {Function} moveBlocksToPosition A function that moves blocks. - * @param {Function} insertBlocks A function that inserts blocks. - * @param {Function} clearSelectedBlock A function that clears block selection. - * @return {Function} The event handler for a block drop event. - */ - -function use_on_block_drop_onBlockDrop(targetRootClientId, targetBlockIndex, getBlockIndex, getClientIdsOfDescendants, moveBlocksToPosition, insertBlocks, clearSelectedBlock) { - return event => { - const { - srcRootClientId: sourceRootClientId, - srcClientIds: sourceClientIds, - type: dropType, - blocks - } = parseDropEvent(event); // If the user is inserting a block - - if (dropType === 'inserter') { - clearSelectedBlock(); - insertBlocks(blocks, targetBlockIndex, targetRootClientId, true, null); - } // If the user is moving a block - - - if (dropType === 'block') { - const sourceBlockIndex = getBlockIndex(sourceClientIds[0], sourceRootClientId); // If the user is dropping to the same position, return early. - - if (sourceRootClientId === targetRootClientId && sourceBlockIndex === targetBlockIndex) { - return; - } // If the user is attempting to drop a block within its own - // nested blocks, return early as this would create infinite - // recursion. - - - if (sourceClientIds.includes(targetRootClientId) || getClientIdsOfDescendants(sourceClientIds).some(id => id === targetRootClientId)) { - return; - } - - const isAtSameLevel = sourceRootClientId === targetRootClientId; - const draggedBlockCount = sourceClientIds.length; // If the block is kept at the same level and moved downwards, - // subtract to take into account that the blocks being dragged - // were removed from the block list above the insertion point. - - const insertIndex = isAtSameLevel && sourceBlockIndex < targetBlockIndex ? targetBlockIndex - draggedBlockCount : targetBlockIndex; - moveBlocksToPosition(sourceClientIds, sourceRootClientId, targetRootClientId, insertIndex); - } - }; -} -/** - * A function that returns an event handler function for block-related file drop events. - * - * @param {string} targetRootClientId The root client id where the block(s) will be inserted. - * @param {number} targetBlockIndex The index where the block(s) will be inserted. - * @param {boolean} hasUploadPermissions Whether the user has upload permissions. - * @param {Function} updateBlockAttributes A function that updates a block's attributes. - * @param {Function} canInsertBlockType A function that returns checks whether a block type can be inserted. - * @param {Function} insertBlocks A function that inserts blocks. - * - * @return {Function} The event handler for a block-related file drop event. - */ - -function onFilesDrop(targetRootClientId, targetBlockIndex, hasUploadPermissions, updateBlockAttributes, canInsertBlockType, insertBlocks) { - return files => { - if (!hasUploadPermissions) { - return; - } - - const transformation = Object(external_wp_blocks_["findTransform"])(Object(external_wp_blocks_["getBlockTransforms"])('from'), transform => transform.type === 'files' && canInsertBlockType(transform.blockName, targetRootClientId) && transform.isMatch(files)); - - if (transformation) { - const blocks = transformation.transform(files, updateBlockAttributes); - insertBlocks(blocks, targetBlockIndex, targetRootClientId); - } - }; -} -/** - * A function that returns an event handler function for block-related HTML drop events. - * - * @param {string} targetRootClientId The root client id where the block(s) will be inserted. - * @param {number} targetBlockIndex The index where the block(s) will be inserted. - * @param {Function} insertBlocks A function that inserts blocks. - * - * @return {Function} The event handler for a block-related HTML drop event. - */ - -function use_on_block_drop_onHTMLDrop(targetRootClientId, targetBlockIndex, insertBlocks) { - return HTML => { - const blocks = Object(external_wp_blocks_["pasteHandler"])({ - HTML, - mode: 'BLOCKS' - }); - - if (blocks.length) { - insertBlocks(blocks, targetBlockIndex, targetRootClientId); - } - }; -} -/** - * A React hook for handling block drop events. - * - * @param {string} targetRootClientId The root client id where the block(s) will be inserted. - * @param {number} targetBlockIndex The index where the block(s) will be inserted. - * - * @return {Object} An object that contains the event handlers `onDrop`, `onFilesDrop` and `onHTMLDrop`. - */ - -function useOnBlockDrop(targetRootClientId, targetBlockIndex) { - const hasUploadPermissions = Object(external_wp_data_["useSelect"])(select => select(store).getSettings().mediaUpload, []); - const { - canInsertBlockType, - getBlockIndex, - getClientIdsOfDescendants - } = Object(external_wp_data_["useSelect"])(store); - const { - insertBlocks, - moveBlocksToPosition, - updateBlockAttributes, - clearSelectedBlock - } = Object(external_wp_data_["useDispatch"])(store); - - const _onDrop = use_on_block_drop_onBlockDrop(targetRootClientId, targetBlockIndex, getBlockIndex, getClientIdsOfDescendants, moveBlocksToPosition, insertBlocks, clearSelectedBlock); - - const _onFilesDrop = onFilesDrop(targetRootClientId, targetBlockIndex, hasUploadPermissions, updateBlockAttributes, canInsertBlockType, insertBlocks); - - const _onHTMLDrop = use_on_block_drop_onHTMLDrop(targetRootClientId, targetBlockIndex, insertBlocks); - - return event => { - const files = Object(external_wp_dom_["getFilesFromDataTransfer"])(event.dataTransfer); - const html = event.dataTransfer.getData('text/html'); - - if (files.length) { - _onFilesDrop(files); - } else if (html) { - _onHTMLDrop(html); - } else { - _onDrop(event); - } - }; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/math.js -/** - * A string representing the name of an edge. - * - * @typedef {'top'|'right'|'bottom'|'left'} WPEdgeName - */ - -/** - * @typedef {Object} WPPoint - * @property {number} x The horizontal position. - * @property {number} y The vertical position. - */ - -/** - * Given a point, a DOMRect and the name of an edge, returns the distance to - * that edge of the rect. - * - * This function works for edges that are horizontal or vertical (e.g. not - * rotated), the following terms are used so that the function works in both - * orientations: - * - * - Forward, meaning the axis running horizontally when an edge is vertical - * and vertically when an edge is horizontal. - * - Lateral, meaning the axis running vertically when an edge is vertical - * and horizontally when an edge is horizontal. - * - * @param {WPPoint} point The point to measure distance from. - * @param {DOMRect} rect A DOM Rect containing edge positions. - * @param {WPEdgeName} edge The edge to measure to. - */ -function getDistanceFromPointToEdge(point, rect, edge) { - const isHorizontal = edge === 'top' || edge === 'bottom'; - const { - x, - y - } = point; - const pointLateralPosition = isHorizontal ? x : y; - const pointForwardPosition = isHorizontal ? y : x; - const edgeStart = isHorizontal ? rect.left : rect.top; - const edgeEnd = isHorizontal ? rect.right : rect.bottom; - const edgeForwardPosition = rect[edge]; // Measure the straight line distance to the edge of the rect, when the - // point is adjacent to the edge. - // Else, if the point is positioned diagonally to the edge of the rect, - // measure diagonally to the nearest corner that the edge meets. - - let edgeLateralPosition; - - if (pointLateralPosition >= edgeStart && pointLateralPosition <= edgeEnd) { - edgeLateralPosition = pointLateralPosition; - } else if (pointLateralPosition < edgeEnd) { - edgeLateralPosition = edgeStart; - } else { - edgeLateralPosition = edgeEnd; - } - - return Math.sqrt((pointLateralPosition - edgeLateralPosition) ** 2 + (pointForwardPosition - edgeForwardPosition) ** 2); -} -/** - * Given a point, a DOMRect and a list of allowed edges returns the name of and - * distance to the nearest edge. - * - * @param {WPPoint} point The point to measure distance from. - * @param {DOMRect} rect A DOM Rect containing edge positions. - * @param {WPEdgeName[]} allowedEdges A list of the edges included in the - * calculation. Defaults to all edges. - * - * @return {[number, string]} An array where the first value is the distance - * and a second is the edge name. - */ - -function getDistanceToNearestEdge(point, rect, allowedEdges = ['top', 'bottom', 'left', 'right']) { - let candidateDistance; - let candidateEdge; - allowedEdges.forEach(edge => { - const distance = getDistanceFromPointToEdge(point, rect, edge); - - if (candidateDistance === undefined || distance < candidateDistance) { - candidateDistance = distance; - candidateEdge = edge; - } - }); - return [candidateDistance, candidateEdge]; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-block-drop-zone/index.js -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - -/** @typedef {import('../../utils/math').WPPoint} WPPoint */ - -/** - * The orientation of a block list. - * - * @typedef {'horizontal'|'vertical'|undefined} WPBlockListOrientation - */ - -/** - * Given a list of block DOM elements finds the index that a block should be dropped - * at. - * - * @param {Element[]} elements Array of DOM elements that represent each block in a block list. - * @param {WPPoint} position The position of the item being dragged. - * @param {WPBlockListOrientation} orientation The orientation of a block list. - * - * @return {number|undefined} The block index that's closest to the drag position. - */ - -function getNearestBlockIndex(elements, position, orientation) { - const allowedEdges = orientation === 'horizontal' ? ['left', 'right'] : ['top', 'bottom']; - const isRightToLeft = Object(external_wp_i18n_["isRTL"])(); - let candidateIndex; - let candidateDistance; - elements.forEach((element, index) => { - const rect = element.getBoundingClientRect(); - const [distance, edge] = getDistanceToNearestEdge(position, rect, allowedEdges); - - if (candidateDistance === undefined || distance < candidateDistance) { - // If the user is dropping to the trailing edge of the block - // add 1 to the index to represent dragging after. - // Take RTL languages into account where the left edge is - // the trailing edge. - const isTrailingEdge = edge === 'bottom' || !isRightToLeft && edge === 'right' || isRightToLeft && edge === 'left'; - const offset = isTrailingEdge ? 1 : 0; // Update the currently known best candidate. - - candidateDistance = distance; - candidateIndex = index + offset; - } - }); - return candidateIndex; -} -/** - * @typedef {Object} WPBlockDropZoneConfig - * @property {string} rootClientId The root client id for the block list. - */ - -/** - * A React hook that can be used to make a block list handle drag and drop. - * - * @param {WPBlockDropZoneConfig} dropZoneConfig configuration data for the drop zone. - */ - -function useBlockDropZone({ - // An undefined value represents a top-level block. Default to an empty - // string for this so that `targetRootClientId` can be easily compared to - // values returned by the `getRootBlockClientId` selector, which also uses - // an empty string to represent top-level blocks. - rootClientId: targetRootClientId = '' -} = {}) { - const [targetBlockIndex, setTargetBlockIndex] = Object(external_wp_element_["useState"])(null); - const isLockedAll = Object(external_wp_data_["useSelect"])(select => { - const { - getTemplateLock - } = select(store); - return getTemplateLock(targetRootClientId) === 'all'; - }, [targetRootClientId]); - const { - getBlockListSettings - } = Object(external_wp_data_["useSelect"])(store); - const { - showInsertionPoint, - hideInsertionPoint - } = Object(external_wp_data_["useDispatch"])(store); - const onBlockDrop = useOnBlockDrop(targetRootClientId, targetBlockIndex); - const throttled = Object(external_wp_compose_["useThrottle"])(Object(external_wp_element_["useCallback"])((event, currentTarget) => { - var _getBlockListSettings; - - const blockElements = Array.from(currentTarget.children).filter( // Ensure the element is a block. It should have the `wp-block` class. - element => element.classList.contains('wp-block')); - const targetIndex = getNearestBlockIndex(blockElements, { - x: event.clientX, - y: event.clientY - }, (_getBlockListSettings = getBlockListSettings(targetRootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation); - setTargetBlockIndex(targetIndex === undefined ? 0 : targetIndex); - - if (targetIndex !== null) { - showInsertionPoint(targetRootClientId, targetIndex); - } - }, []), 200); - return Object(external_wp_compose_["__experimentalUseDropZone"])({ - isDisabled: isLockedAll, - onDrop: onBlockDrop, - - onDragOver(event) { - // `currentTarget` is only available while the event is being - // handled, so get it now and pass it to the thottled function. - // https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget - throttled(event, event.currentTarget); - }, - - onDragLeave() { - throttled.cancel(); - hideInsertionPoint(); - setTargetBlockIndex(null); - }, - - onDragEnd() { - throttled.cancel(); - hideInsertionPoint(); - setTargetBlockIndex(null); - } - - }); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/use-popover-scroll.js -/** - * WordPress dependencies - */ - -/** - * Allow scrolling "through" popovers over the canvas. This is only called for - * as long as the pointer is over a popover. Do not use React events because it - * will bubble through portals. - * - * @param {Object} scrollableRef - */ - -function usePopoverScroll(scrollableRef) { - return Object(external_wp_compose_["useRefEffect"])(node => { - if (!scrollableRef) { - return; - } - - function onWheel(event) { - const { - deltaX, - deltaY - } = event; - scrollableRef.current.scrollBy(deltaX, deltaY); - } - - node.addEventListener('wheel', onWheel); - return () => { - node.removeEventListener('wheel', onWheel); - }; - }, [scrollableRef]); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/insertion-point.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - - - -const InsertionPointOpenRef = Object(external_wp_element_["createContext"])(); - -function InsertionPointPopover({ - __unstablePopoverSlot, - __unstableContentRef -}) { - const { - selectBlock - } = Object(external_wp_data_["useDispatch"])(store); - const openRef = Object(external_wp_element_["useContext"])(InsertionPointOpenRef); - const ref = Object(external_wp_element_["useRef"])(); - const { - orientation, - previousClientId, - nextClientId, - rootClientId, - isInserterShown - } = Object(external_wp_data_["useSelect"])(select => { - var _getBlockListSettings; - - const { - getBlockOrder, - getBlockListSettings, - getBlockInsertionPoint, - isBlockBeingDragged, - getPreviousBlockClientId, - getNextBlockClientId - } = select(store); - const insertionPoint = getBlockInsertionPoint(); - const order = getBlockOrder(insertionPoint.rootClientId); - - if (!order.length) { - return {}; - } - - let _previousClientId = order[insertionPoint.index - 1]; - let _nextClientId = order[insertionPoint.index]; - - while (isBlockBeingDragged(_previousClientId)) { - _previousClientId = getPreviousBlockClientId(_previousClientId); - } - - while (isBlockBeingDragged(_nextClientId)) { - _nextClientId = getNextBlockClientId(_nextClientId); - } - - return { - previousClientId: _previousClientId, - nextClientId: _nextClientId, - orientation: ((_getBlockListSettings = getBlockListSettings(insertionPoint.rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation) || 'vertical', - rootClientId: insertionPoint.rootClientId, - isInserterShown: insertionPoint === null || insertionPoint === void 0 ? void 0 : insertionPoint.__unstableWithInserter - }; - }, []); - const previousElement = useBlockElement(previousClientId); - const nextElement = useBlockElement(nextClientId); - const style = Object(external_wp_element_["useMemo"])(() => { - if (!previousElement && !nextElement) { - return {}; - } - - const previousRect = previousElement ? previousElement.getBoundingClientRect() : null; - const nextRect = nextElement ? nextElement.getBoundingClientRect() : null; - - if (orientation === 'vertical') { - return { - width: previousElement ? previousElement.offsetWidth : nextElement.offsetWidth, - height: nextRect && previousRect ? nextRect.top - previousRect.bottom : 0 - }; - } - - let width = 0; - - if (previousRect && nextRect) { - width = Object(external_wp_i18n_["isRTL"])() ? previousRect.left - nextRect.right : nextRect.left - previousRect.right; - } - - return { - width, - height: previousElement ? previousElement.offsetHeight : nextElement.offsetHeight - }; - }, [previousElement, nextElement]); - const getAnchorRect = Object(external_wp_element_["useCallback"])(() => { - if (!previousElement && !nextElement) { - return {}; - } - - const { - ownerDocument - } = previousElement || nextElement; - const previousRect = previousElement ? previousElement.getBoundingClientRect() : null; - const nextRect = nextElement ? nextElement.getBoundingClientRect() : null; - - if (orientation === 'vertical') { - if (Object(external_wp_i18n_["isRTL"])()) { - return { - top: previousRect ? previousRect.bottom : nextRect.top, - left: previousRect ? previousRect.right : nextRect.right, - right: previousRect ? previousRect.left : nextRect.left, - bottom: nextRect ? nextRect.top : previousRect.bottom, - ownerDocument - }; - } - - return { - top: previousRect ? previousRect.bottom : nextRect.top, - left: previousRect ? previousRect.left : nextRect.left, - right: previousRect ? previousRect.right : nextRect.right, - bottom: nextRect ? nextRect.top : previousRect.bottom, - ownerDocument - }; - } - - if (Object(external_wp_i18n_["isRTL"])()) { - return { - top: previousRect ? previousRect.top : nextRect.top, - left: previousRect ? previousRect.left : nextRect.right, - right: nextRect ? nextRect.right : previousRect.left, - bottom: previousRect ? previousRect.bottom : nextRect.bottom, - ownerDocument - }; - } - - return { - top: previousRect ? previousRect.top : nextRect.top, - left: previousRect ? previousRect.right : nextRect.left, - right: nextRect ? nextRect.left : previousRect.right, - bottom: previousRect ? previousRect.bottom : nextRect.bottom, - ownerDocument - }; - }, [previousElement, nextElement]); - const popoverScrollRef = usePopoverScroll(__unstableContentRef); - const className = classnames_default()('block-editor-block-list__insertion-point', 'is-' + orientation); - - function onClick(event) { - if (event.target === ref.current && nextClientId) { - selectBlock(nextClientId, -1); - } - } - - function onFocus(event) { - // Only handle click on the wrapper specifically, and not an event - // bubbled from the inserter itself. - if (event.target !== ref.current) { - openRef.current = true; - } - } // Only show the in-between inserter between blocks, so when there's a - // previous and a next element. - - - const showInsertionPointInserter = previousElement && nextElement && isInserterShown; - /* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */ - // 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 - - return Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], { - ref: popoverScrollRef, - noArrow: true, - animate: false, - getAnchorRect: getAnchorRect, - focusOnMount: false, - className: "block-editor-block-list__insertion-point-popover" // Render in the old slot if needed for backward compatibility, - // otherwise render in place (not in the the default popover slot). - , - __unstableSlotName: __unstablePopoverSlot || null - }, Object(external_wp_element_["createElement"])("div", { - ref: ref, - tabIndex: -1, - onClick: onClick, - onFocus: onFocus, - className: classnames_default()(className, { - 'is-with-inserter': showInsertionPointInserter - }), - style: style - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-list__insertion-point-indicator" - }), showInsertionPointInserter && Object(external_wp_element_["createElement"])("div", { - className: classnames_default()('block-editor-block-list__insertion-point-inserter') - }, Object(external_wp_element_["createElement"])(inserter, { - position: "bottom center", - clientId: nextClientId, - rootClientId: rootClientId, - __experimentalIsQuick: true, - onToggle: isOpen => { - openRef.current = isOpen; - }, - onSelectOrClose: () => { - openRef.current = false; - } - })))); - /* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */ -} - -function InsertionPoint({ - children, - __unstablePopoverSlot, - __unstableContentRef -}) { - const isVisible = Object(external_wp_data_["useSelect"])(select => { - return select(store).isBlockInsertionPointVisible(); - }, []); - return Object(external_wp_element_["createElement"])(InsertionPointOpenRef.Provider, { - value: Object(external_wp_element_["useRef"])(false) - }, isVisible && Object(external_wp_element_["createElement"])(InsertionPointPopover, { - __unstablePopoverSlot: __unstablePopoverSlot, - __unstableContentRef: __unstableContentRef - }), children); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-in-between-inserter.js -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - -function useInBetweenInserter() { - const openRef = Object(external_wp_element_["useContext"])(InsertionPointOpenRef); - const hasReducedUI = Object(external_wp_data_["useSelect"])(select => select(store).getSettings().hasReducedUI, []); - const { - getBlockListSettings, - getBlockRootClientId, - getBlockIndex, - isBlockInsertionPointVisible, - isMultiSelecting, - getSelectedBlockClientIds, - getTemplateLock - } = Object(external_wp_data_["useSelect"])(store); - const { - showInsertionPoint, - hideInsertionPoint - } = Object(external_wp_data_["useDispatch"])(store); - return Object(external_wp_compose_["useRefEffect"])(node => { - if (hasReducedUI) { - return; - } - - function onMouseMove(event) { - var _getBlockListSettings; - - if (openRef.current) { - return; - } - - if (isMultiSelecting()) { - return; - } - - if (!event.target.classList.contains('block-editor-block-list__layout')) { - if (isBlockInsertionPointVisible()) { - hideInsertionPoint(); - } - - return; - } - - let rootClientId; - - if (!event.target.classList.contains('is-root-container')) { - const blockElement = !!event.target.getAttribute('data-block') ? event.target : event.target.closest('[data-block]'); - rootClientId = blockElement.getAttribute('data-block'); - } // Don't set the insertion point if the template is locked. - - - if (getTemplateLock(rootClientId)) { - return; - } - - const orientation = ((_getBlockListSettings = getBlockListSettings(rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation) || 'vertical'; - const rect = event.target.getBoundingClientRect(); - const offsetTop = event.clientY - rect.top; - const offsetLeft = event.clientX - rect.left; - const children = Array.from(event.target.children); - let element = children.find(blockEl => { - return blockEl.classList.contains('wp-block') && orientation === 'vertical' && blockEl.offsetTop > offsetTop || blockEl.classList.contains('wp-block') && orientation === 'horizontal' && blockEl.offsetLeft > offsetLeft; - }); - - if (!element) { - return; - } // The block may be in an alignment wrapper, so check the first direct - // child if the element has no ID. - - - if (!element.id) { - element = element.firstElementChild; - - if (!element) { - return; - } - } - - const clientId = element.id.slice('block-'.length); - - if (!clientId) { - return; - } // Don't show the inserter when hovering above (conflicts with - // block toolbar) or inside selected block(s). - - - if (getSelectedBlockClientIds().includes(clientId)) { - return; - } - - const elementRect = element.getBoundingClientRect(); - - if (orientation === 'horizontal' && (event.clientY > elementRect.bottom || event.clientY < elementRect.top) || orientation === 'vertical' && (event.clientX > elementRect.right || event.clientX < elementRect.left)) { - if (isBlockInsertionPointVisible()) { - hideInsertionPoint(); - } - - return; - } - - const index = getBlockIndex(clientId, rootClientId); // Don't show the in-between inserter before the first block in - // the list (preserves the original behaviour). - - if (index === 0) { - if (isBlockInsertionPointVisible()) { - hideInsertionPoint(); - } - - return; - } - - showInsertionPoint(rootClientId, index, { - __unstableWithInserter: true - }); - } - - node.addEventListener('mousemove', onMouseMove); - return () => { - node.removeEventListener('mousemove', onMouseMove); - }; - }, [openRef, getBlockListSettings, getBlockRootClientId, getBlockIndex, isBlockInsertionPointVisible, isMultiSelecting, showInsertionPoint, hideInsertionPoint, getSelectedBlockClientIds]); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/pre-parse-patterns.js -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - - -const pre_parse_patterns_requestIdleCallback = (() => { - if (typeof window === 'undefined') { - return callback => { - setTimeout(() => callback(Date.now()), 0); - }; - } - - return window.requestIdleCallback || window.requestAnimationFrame; -})(); - -const cancelIdleCallback = (() => { - if (typeof window === 'undefined') { - return clearTimeout; - } - - return window.cancelIdleCallback || window.cancelAnimationFrame; -})(); - -function usePreParsePatterns() { - const patterns = Object(external_wp_data_["useSelect"])(_select => _select(store).getSettings().__experimentalBlockPatterns, []); - Object(external_wp_element_["useEffect"])(() => { - if (!(patterns !== null && patterns !== void 0 && patterns.length)) { - return; - } - - let handle; - let index = -1; - - const callback = () => { - index++; - - if (index >= patterns.length) { - return; - } - - Object(external_wp_data_["select"])(store).__experimentalGetParsedPattern(patterns[index].name); - - handle = pre_parse_patterns_requestIdleCallback(callback); - }; - - handle = pre_parse_patterns_requestIdleCallback(callback); - return () => cancelIdleCallback(handle); - }, [patterns]); - return null; -} - -// EXTERNAL MODULE: external ["wp","keyboardShortcuts"] -var external_wp_keyboardShortcuts_ = __webpack_require__("hF7m"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/use-scroll-when-dragging.js -/** - * WordPress dependencies - */ - - -const SCROLL_INACTIVE_DISTANCE_PX = 50; -const SCROLL_INTERVAL_MS = 25; -const PIXELS_PER_SECOND_PER_PERCENTAGE = 1000; -const VELOCITY_MULTIPLIER = PIXELS_PER_SECOND_PER_PERCENTAGE * (SCROLL_INTERVAL_MS / 1000); -/** - * React hook that scrolls the scroll container when a block is being dragged. - * - * @return {Function[]} `startScrolling`, `scrollOnDragOver`, `stopScrolling` - * functions to be called in `onDragStart`, `onDragOver` - * and `onDragEnd` events respectively. - */ - -function useScrollWhenDragging() { - const dragStartY = Object(external_wp_element_["useRef"])(null); - const velocityY = Object(external_wp_element_["useRef"])(null); - const scrollParentY = Object(external_wp_element_["useRef"])(null); - const scrollEditorInterval = Object(external_wp_element_["useRef"])(null); // Clear interval when unmounting. - - Object(external_wp_element_["useEffect"])(() => () => { - if (scrollEditorInterval.current) { - clearInterval(scrollEditorInterval.current); - scrollEditorInterval.current = null; - } - }, []); - const startScrolling = Object(external_wp_element_["useCallback"])(event => { - dragStartY.current = event.clientY; // Find nearest parent(s) to scroll. - - scrollParentY.current = Object(external_wp_dom_["getScrollContainer"])(event.target); - scrollEditorInterval.current = setInterval(() => { - if (scrollParentY.current && velocityY.current) { - const newTop = scrollParentY.current.scrollTop + velocityY.current; // Setting `behavior: 'smooth'` as a scroll property seems to hurt performance. - // Better to use a small scroll interval. - - scrollParentY.current.scroll({ - top: newTop - }); - } - }, SCROLL_INTERVAL_MS); - }, []); - const scrollOnDragOver = Object(external_wp_element_["useCallback"])(event => { - if (!scrollParentY.current) { - return; - } - - const scrollParentHeight = scrollParentY.current.offsetHeight; - const offsetDragStartPosition = dragStartY.current - scrollParentY.current.offsetTop; - const offsetDragPosition = event.clientY - scrollParentY.current.offsetTop; - - if (event.clientY > offsetDragStartPosition) { - // User is dragging downwards. - const moveableDistance = Math.max(scrollParentHeight - offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0); - const dragDistance = Math.max(offsetDragPosition - offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0); - const distancePercentage = dragDistance / moveableDistance; - velocityY.current = VELOCITY_MULTIPLIER * distancePercentage; - } else if (event.clientY < offsetDragStartPosition) { - // User is dragging upwards. - const moveableDistance = Math.max(offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0); - const dragDistance = Math.max(offsetDragStartPosition - offsetDragPosition - SCROLL_INACTIVE_DISTANCE_PX, 0); - const distancePercentage = dragDistance / moveableDistance; - velocityY.current = -VELOCITY_MULTIPLIER * distancePercentage; - } else { - velocityY.current = 0; - } - }, []); - - const stopScrolling = () => { - dragStartY.current = null; - scrollParentY.current = null; - - if (scrollEditorInterval.current) { - clearInterval(scrollEditorInterval.current); - scrollEditorInterval.current = null; - } - }; - - return [startScrolling, scrollOnDragOver, stopScrolling]; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/index.js - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - - -const BlockDraggable = ({ - children, - clientIds, - cloneClassname, - onDragStart, - onDragEnd, - elementId -}) => { - const { - srcRootClientId, - isDraggable, - icon - } = Object(external_wp_data_["useSelect"])(select => { - var _getBlockType; - - const { - getBlockRootClientId, - getTemplateLock, - getBlockName - } = select(store); - const rootClientId = getBlockRootClientId(clientIds[0]); - const templateLock = rootClientId ? getTemplateLock(rootClientId) : null; - const blockName = getBlockName(clientIds[0]); - return { - srcRootClientId: rootClientId, - isDraggable: 'all' !== templateLock, - icon: (_getBlockType = Object(external_wp_blocks_["getBlockType"])(blockName)) === null || _getBlockType === void 0 ? void 0 : _getBlockType.icon - }; - }, [clientIds]); - const isDragging = Object(external_wp_element_["useRef"])(false); - const [startScrolling, scrollOnDragOver, stopScrolling] = useScrollWhenDragging(); - const { - startDraggingBlocks, - stopDraggingBlocks - } = Object(external_wp_data_["useDispatch"])(store); // Stop dragging blocks if the block draggable is unmounted - - Object(external_wp_element_["useEffect"])(() => { - return () => { - if (isDragging.current) { - stopDraggingBlocks(); - } - }; - }, []); - - if (!isDraggable) { - return children({ - isDraggable: false - }); - } - - const transferData = { - type: 'block', - srcClientIds: clientIds, - srcRootClientId - }; - return Object(external_wp_element_["createElement"])(external_wp_components_["Draggable"], { - cloneClassname: cloneClassname, - elementId: elementId, - __experimentalTransferDataType: "wp-blocks", - transferData: transferData, - onDragStart: event => { - startDraggingBlocks(clientIds); - isDragging.current = true; - startScrolling(event); - - if (onDragStart) { - onDragStart(); - } - }, - onDragOver: scrollOnDragOver, - onDragEnd: () => { - stopDraggingBlocks(); - isDragging.current = false; - stopScrolling(); - - if (onDragEnd) { - onDragEnd(); - } - }, - __experimentalDragComponent: Object(external_wp_element_["createElement"])(BlockDraggableChip, { - count: clientIds.length, - icon: icon - }) - }, ({ - onDraggableStart, - onDraggableEnd - }) => { - return children({ - draggable: true, - onDragStart: onDraggableStart, - onDragEnd: onDraggableEnd - }); - }); -}; - -/* harmony default export */ var block_draggable = (BlockDraggable); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/block-selection-button.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - - - - - -/** - * Internal dependencies - */ - - - - - - -/** - * Returns true if the user is using windows. - * - * @return {boolean} Whether the user is using Windows. - */ - -function isWindows() { - return window.navigator.platform.indexOf('Win') > -1; -} -/** - * Block selection button 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 Component props. - * @param {string} props.clientId Client ID of block. - * - * @return {WPComponent} The component to be rendered. - */ - - -function BlockSelectionButton({ - clientId, - rootClientId, - blockElement -}) { - const blockInformation = useBlockDisplayInformation(clientId); - const selected = Object(external_wp_data_["useSelect"])(select => { - var _getBlockListSettings; - - const { - __unstableGetBlockWithoutInnerBlocks, - getBlockIndex, - hasBlockMovingClientId, - getBlockListSettings - } = select(store); - const index = getBlockIndex(clientId, rootClientId); - - const { - name, - attributes - } = __unstableGetBlockWithoutInnerBlocks(clientId); - - const blockMovingMode = hasBlockMovingClientId(); - return { - index, - name, - attributes, - blockMovingMode, - orientation: (_getBlockListSettings = getBlockListSettings(rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation - }; - }, [clientId, rootClientId]); - const { - index, - name, - attributes, - blockMovingMode, - orientation - } = selected; - const { - setNavigationMode, - removeBlock - } = Object(external_wp_data_["useDispatch"])(store); - const ref = Object(external_wp_element_["useRef"])(); // Focus the breadcrumb in navigation mode. - - Object(external_wp_element_["useEffect"])(() => { - ref.current.focus(); // NVDA on windows suffers from a bug where focus changes are not announced properly - // See WordPress/gutenberg#24121 and nvaccess/nvda#5825 for more details - // To solve it we announce the focus change manually. - - if (isWindows()) { - Object(external_wp_a11y_["speak"])(label); - } - }, []); - const { - hasBlockMovingClientId, - getBlockIndex, - getBlockRootClientId, - getClientIdsOfDescendants, - getSelectedBlockClientId, - getMultiSelectedBlocksEndClientId, - getPreviousBlockClientId, - getNextBlockClientId - } = Object(external_wp_data_["useSelect"])(store); - const { - selectBlock, - clearSelectedBlock, - setBlockMovingClientId, - moveBlockToPosition - } = Object(external_wp_data_["useDispatch"])(store); - - function onKeyDown(event) { - const { - keyCode - } = event; - const isUp = keyCode === external_wp_keycodes_["UP"]; - const isDown = keyCode === external_wp_keycodes_["DOWN"]; - const isLeft = keyCode === external_wp_keycodes_["LEFT"]; - const isRight = keyCode === external_wp_keycodes_["RIGHT"]; - const isTab = keyCode === external_wp_keycodes_["TAB"]; - const isEscape = keyCode === external_wp_keycodes_["ESCAPE"]; - const isEnter = keyCode === external_wp_keycodes_["ENTER"]; - const isSpace = keyCode === external_wp_keycodes_["SPACE"]; - const isShift = event.shiftKey; - - if (keyCode === external_wp_keycodes_["BACKSPACE"] || keyCode === external_wp_keycodes_["DELETE"]) { - removeBlock(clientId); - event.preventDefault(); - return; - } - - const selectedBlockClientId = getSelectedBlockClientId(); - const selectionEndClientId = getMultiSelectedBlocksEndClientId(); - const selectionBeforeEndClientId = getPreviousBlockClientId(selectionEndClientId || selectedBlockClientId); - const selectionAfterEndClientId = getNextBlockClientId(selectionEndClientId || selectedBlockClientId); - const navigateUp = isTab && isShift || isUp; - const navigateDown = isTab && !isShift || isDown; // Move out of current nesting level (no effect if at root level). - - const navigateOut = isLeft; // Move into next nesting level (no effect if the current block has no innerBlocks). - - const navigateIn = isRight; - let focusedBlockUid; - - if (navigateUp) { - focusedBlockUid = selectionBeforeEndClientId; - } else if (navigateDown) { - focusedBlockUid = selectionAfterEndClientId; - } else if (navigateOut) { - var _getBlockRootClientId; - - focusedBlockUid = (_getBlockRootClientId = getBlockRootClientId(selectedBlockClientId)) !== null && _getBlockRootClientId !== void 0 ? _getBlockRootClientId : selectedBlockClientId; - } else if (navigateIn) { - var _getClientIdsOfDescen; - - focusedBlockUid = (_getClientIdsOfDescen = getClientIdsOfDescendants([selectedBlockClientId])[0]) !== null && _getClientIdsOfDescen !== void 0 ? _getClientIdsOfDescen : selectedBlockClientId; - } - - const startingBlockClientId = hasBlockMovingClientId(); - - if (isEscape && startingBlockClientId) { - setBlockMovingClientId(null); - } - - if ((isEnter || isSpace) && startingBlockClientId) { - const sourceRoot = getBlockRootClientId(startingBlockClientId); - const destRoot = getBlockRootClientId(selectedBlockClientId); - const sourceBlockIndex = getBlockIndex(startingBlockClientId, sourceRoot); - let destinationBlockIndex = getBlockIndex(selectedBlockClientId, destRoot); - - if (sourceBlockIndex < destinationBlockIndex && sourceRoot === destRoot) { - destinationBlockIndex -= 1; - } - - moveBlockToPosition(startingBlockClientId, sourceRoot, destRoot, destinationBlockIndex); - selectBlock(startingBlockClientId); - setBlockMovingClientId(null); - } - - if (navigateDown || navigateUp || navigateOut || navigateIn) { - if (focusedBlockUid) { - event.preventDefault(); - selectBlock(focusedBlockUid); - } else if (isTab && selectedBlockClientId) { - let nextTabbable; - - if (navigateDown) { - nextTabbable = external_wp_dom_["focus"].tabbable.findNext(blockElement); - - if (!nextTabbable) { - nextTabbable = blockElement.ownerDocument.defaultView.frameElement; - nextTabbable = external_wp_dom_["focus"].tabbable.findNext(nextTabbable); - } - } else { - nextTabbable = external_wp_dom_["focus"].tabbable.findPrevious(blockElement); - } - - if (nextTabbable) { - event.preventDefault(); - nextTabbable.focus(); - clearSelectedBlock(); - } - } - } - } - - const blockType = Object(external_wp_blocks_["getBlockType"])(name); - const label = Object(external_wp_blocks_["__experimentalGetAccessibleBlockLabel"])(blockType, attributes, index + 1, orientation); - const classNames = classnames_default()('block-editor-block-list__block-selection-button', { - 'is-block-moving-mode': !!blockMovingMode - }); - - const dragHandleLabel = Object(external_wp_i18n_["__"])('Drag'); - - return Object(external_wp_element_["createElement"])("div", { - className: classNames - }, Object(external_wp_element_["createElement"])(external_wp_components_["Flex"], { - justify: "center", - className: "block-editor-block-list__block-selection-button__content" - }, Object(external_wp_element_["createElement"])(external_wp_components_["FlexItem"], null, Object(external_wp_element_["createElement"])(BlockIcon, { - icon: blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon, - showColors: true - })), Object(external_wp_element_["createElement"])(external_wp_components_["FlexItem"], null, Object(external_wp_element_["createElement"])(block_draggable, { - clientIds: [clientId] - }, draggableProps => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({ - icon: drag_handle, - className: "block-selection-button_drag-handle", - "aria-hidden": "true", - label: dragHandleLabel // Should not be able to tab to drag handle as this - // button can only be used with a pointer device. - , - tabIndex: "-1" - }, draggableProps)))), Object(external_wp_element_["createElement"])(external_wp_components_["FlexItem"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - ref: ref, - onClick: () => setNavigationMode(false), - onKeyDown: onKeyDown, - label: label, - className: "block-selection-button_select-button" - }, Object(external_wp_element_["createElement"])(BlockTitle, { - clientId: clientId - }))))); -} - -/* harmony default export */ var block_selection_button = (BlockSelectionButton); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/navigable-toolbar/index.js - - - -/** - * WordPress dependencies - */ - - - - - - -function hasOnlyToolbarItem(elements) { - const dataProp = 'toolbarItem'; - return !elements.some(element => !(dataProp in element.dataset)); -} - -function getAllToolbarItemsIn(container) { - return Array.from(container.querySelectorAll('[data-toolbar-item]')); -} - -function hasFocusWithin(container) { - return container.contains(container.ownerDocument.activeElement); -} - -function focusFirstTabbableIn(container) { - const [firstTabbable] = external_wp_dom_["focus"].tabbable.find(container); - - if (firstTabbable) { - firstTabbable.focus(); - } -} - -function useIsAccessibleToolbar(ref) { - /* - * By default, we'll assume the starting accessible state of the Toolbar - * is true, as it seems to be the most common case. - * - * Transitioning from an (initial) false to true state causes the - * component to mount twice, which is causing undesired - * side-effects. These side-effects appear to only affect certain - * E2E tests. - * - * This was initial discovered in this pull-request: - * https://github.com/WordPress/gutenberg/pull/23425 - */ - const initialAccessibleToolbarState = true; // By default, it's gonna render NavigableMenu. If all the tabbable elements - // inside the toolbar are ToolbarItem components (or derived components like - // ToolbarButton), then we can wrap them with the accessible Toolbar - // component. - - const [isAccessibleToolbar, setIsAccessibleToolbar] = Object(external_wp_element_["useState"])(initialAccessibleToolbarState); - const determineIsAccessibleToolbar = Object(external_wp_element_["useCallback"])(() => { - const tabbables = external_wp_dom_["focus"].tabbable.find(ref.current); - const onlyToolbarItem = hasOnlyToolbarItem(tabbables); - - if (!onlyToolbarItem) { - external_wp_deprecated_default()('Using custom components as toolbar controls', { - since: '5.6', - alternative: 'ToolbarItem, ToolbarButton or ToolbarDropdownMenu components', - link: 'https://developer.wordpress.org/block-editor/components/toolbar-button/#inside-blockcontrols' - }); - } - - setIsAccessibleToolbar(onlyToolbarItem); - }, []); - Object(external_wp_element_["useLayoutEffect"])(() => { - // Toolbar buttons may be rendered asynchronously, so we use - // MutationObserver to check if the toolbar subtree has been modified - const observer = new window.MutationObserver(determineIsAccessibleToolbar); - observer.observe(ref.current, { - childList: true, - subtree: true - }); - return () => observer.disconnect(); - }, [isAccessibleToolbar]); - return isAccessibleToolbar; -} - -function useToolbarFocus(ref, focusOnMount, isAccessibleToolbar, defaultIndex, onIndexChange) { - // Make sure we don't use modified versions of this prop - const [initialFocusOnMount] = Object(external_wp_element_["useState"])(focusOnMount); - const [initialIndex] = Object(external_wp_element_["useState"])(defaultIndex); - const focusToolbar = Object(external_wp_element_["useCallback"])(() => { - focusFirstTabbableIn(ref.current); - }, []); // Focus on toolbar when pressing alt+F10 when the toolbar is visible - - Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/focus-toolbar', focusToolbar, { - bindGlobal: true, - eventName: 'keydown' - }); - Object(external_wp_element_["useEffect"])(() => { - if (initialFocusOnMount) { - focusToolbar(); - } - }, [isAccessibleToolbar, initialFocusOnMount, focusToolbar]); - Object(external_wp_element_["useEffect"])(() => { - // If initialIndex is passed, we focus on that toolbar item when the - // toolbar gets mounted and initial focus is not forced. - // We have to wait for the next browser paint because block controls aren't - // rendered right away when the toolbar gets mounted. - let raf = 0; - - if (initialIndex && !initialFocusOnMount) { - raf = window.requestAnimationFrame(() => { - const items = getAllToolbarItemsIn(ref.current); - const index = initialIndex || 0; - - if (items[index] && hasFocusWithin(ref.current)) { - items[index].focus(); - } - }); - } - - return () => { - window.cancelAnimationFrame(raf); - if (!onIndexChange) return; // When the toolbar element is unmounted and onIndexChange is passed, we - // pass the focused toolbar item index so it can be hydrated later. - - const items = getAllToolbarItemsIn(ref.current); - const index = items.findIndex(item => item.tabIndex === 0); - onIndexChange(index); - }; - }, [initialIndex, initialFocusOnMount]); -} - -function NavigableToolbar({ - children, - focusOnMount, - __experimentalInitialIndex: initialIndex, - __experimentalOnIndexChange: onIndexChange, - ...props -}) { - const ref = Object(external_wp_element_["useRef"])(); - const isAccessibleToolbar = useIsAccessibleToolbar(ref); - useToolbarFocus(ref, focusOnMount, isAccessibleToolbar, initialIndex, onIndexChange); - - if (isAccessibleToolbar) { - return Object(external_wp_element_["createElement"])(external_wp_components_["Toolbar"], Object(esm_extends["a" /* default */])({ - label: props['aria-label'], - ref: ref - }, props), children); - } - - return Object(external_wp_element_["createElement"])(external_wp_components_["NavigableMenu"], Object(esm_extends["a" /* default */])({ - orientation: "horizontal", - role: "toolbar", - ref: ref - }, props), children); -} - -/* harmony default export */ var navigable_toolbar = (NavigableToolbar); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-mover/index.js - - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - - - - -/** - * Internal dependencies - */ - - - - - -function BlockMover({ - isFirst, - isLast, - clientIds, - isLocked, - isHidden, - rootClientId, - orientation, - hideDragHandle -}) { - const [isFocused, setIsFocused] = Object(external_wp_element_["useState"])(false); - - const onFocus = () => setIsFocused(true); - - const onBlur = () => setIsFocused(false); - - if (isLocked || isFirst && isLast && !rootClientId) { - return null; - } - - const dragHandleLabel = Object(external_wp_i18n_["__"])('Drag'); // We emulate a disabled state because forcefully applying the `disabled` - // attribute on the buttons 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_wp_element_["createElement"])("div", { - className: classnames_default()('block-editor-block-mover', { - 'is-visible': isFocused || !isHidden, - 'is-horizontal': orientation === 'horizontal' - }) - }, !hideDragHandle && Object(external_wp_element_["createElement"])(block_draggable, { - clientIds: clientIds, - cloneClassname: "block-editor-block-mover__drag-clone" - }, draggableProps => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({ - icon: drag_handle, - className: "block-editor-block-mover__drag-handle", - "aria-hidden": "true", - label: dragHandleLabel // Should not be able to tab to drag handle as this - // button can only be used with a pointer device. - , - tabIndex: "-1" - }, draggableProps))), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], { - className: "block-editor-block-mover__move-button-container" - }, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], { - onFocus: onFocus, - onBlur: onBlur - }, itemProps => Object(external_wp_element_["createElement"])(BlockMoverUpButton, Object(esm_extends["a" /* default */])({ - clientIds: clientIds - }, itemProps))), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], { - onFocus: onFocus, - onBlur: onBlur - }, itemProps => Object(external_wp_element_["createElement"])(BlockMoverDownButton, Object(esm_extends["a" /* default */])({ - clientIds: clientIds - }, itemProps))))); -} - -/* harmony default export */ var block_mover = (Object(external_wp_data_["withSelect"])((select, { - clientIds -}) => { - var _getBlockListSettings; - - const { - getBlock, - getBlockIndex, - getBlockListSettings, - getTemplateLock, - getBlockOrder, - getBlockRootClientId - } = select(store); - const normalizedClientIds = Object(external_lodash_["castArray"])(clientIds); - const firstClientId = Object(external_lodash_["first"])(normalizedClientIds); - const block = getBlock(firstClientId); - const rootClientId = getBlockRootClientId(Object(external_lodash_["first"])(normalizedClientIds)); - const firstIndex = getBlockIndex(firstClientId, rootClientId); - const lastIndex = getBlockIndex(Object(external_lodash_["last"])(normalizedClientIds), rootClientId); - const blockOrder = getBlockOrder(rootClientId); - const isFirst = firstIndex === 0; - const isLast = lastIndex === blockOrder.length - 1; - return { - blockType: block ? Object(external_wp_blocks_["getBlockType"])(block.name) : null, - isLocked: getTemplateLock(rootClientId) === 'all', - rootClientId, - firstIndex, - isFirst, - isLast, - orientation: (_getBlockListSettings = getBlockListSettings(rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation - }; -})(BlockMover)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/utils.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -const { - clearTimeout: utils_clearTimeout, - setTimeout: utils_setTimeout -} = window; -const DEBOUNCE_TIMEOUT = 200; -/** - * Hook that creates a showMover state, as well as debounced show/hide callbacks. - * - * @param {Object} props Component props. - * @param {Object} props.ref Element reference. - * @param {boolean} props.isFocused Whether the component has current focus. - * @param {number} [props.debounceTimeout=250] Debounce timeout in milliseconds. - * @param {Function} [props.onChange=noop] Callback function. - */ - -function useDebouncedShowMovers({ - ref, - isFocused, - debounceTimeout = DEBOUNCE_TIMEOUT, - onChange = external_lodash_["noop"] -}) { - const [showMovers, setShowMovers] = Object(external_wp_element_["useState"])(false); - const timeoutRef = Object(external_wp_element_["useRef"])(); - - const handleOnChange = nextIsFocused => { - if (ref !== null && ref !== void 0 && ref.current) { - setShowMovers(nextIsFocused); - } - - onChange(nextIsFocused); - }; - - const getIsHovered = () => { - return (ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.matches(':hover'); - }; - - const shouldHideMovers = () => { - const isHovered = getIsHovered(); - return !isFocused && !isHovered; - }; - - const clearTimeoutRef = () => { - const timeout = timeoutRef.current; - - if (timeout && utils_clearTimeout) { - utils_clearTimeout(timeout); - } - }; - - const debouncedShowMovers = event => { - if (event) { - event.stopPropagation(); - } - - clearTimeoutRef(); - - if (!showMovers) { - handleOnChange(true); - } - }; - - const debouncedHideMovers = event => { - if (event) { - event.stopPropagation(); - } - - clearTimeoutRef(); - timeoutRef.current = utils_setTimeout(() => { - if (shouldHideMovers()) { - handleOnChange(false); - } - }, debounceTimeout); - }; - - Object(external_wp_element_["useEffect"])(() => () => clearTimeoutRef(), []); - return { - showMovers, - debouncedShowMovers, - debouncedHideMovers - }; -} -/** - * Hook that provides a showMovers state and gesture events for DOM elements - * that interact with the showMovers state. - * - * @param {Object} props Component props. - * @param {Object} props.ref Element reference. - * @param {number} [props.debounceTimeout=250] Debounce timeout in milliseconds. - * @param {Function} [props.onChange=noop] Callback function. - */ - -function useShowMoversGestures({ - ref, - debounceTimeout = DEBOUNCE_TIMEOUT, - onChange = external_lodash_["noop"] -}) { - const [isFocused, setIsFocused] = Object(external_wp_element_["useState"])(false); - const { - showMovers, - debouncedShowMovers, - debouncedHideMovers - } = useDebouncedShowMovers({ - ref, - debounceTimeout, - isFocused, - onChange - }); - const registerRef = Object(external_wp_element_["useRef"])(false); - - const isFocusedWithin = () => { - return (ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.contains(ref.current.ownerDocument.activeElement); - }; - - Object(external_wp_element_["useEffect"])(() => { - const node = ref.current; - - const handleOnFocus = () => { - if (isFocusedWithin()) { - setIsFocused(true); - debouncedShowMovers(); - } - }; - - const handleOnBlur = () => { - if (!isFocusedWithin()) { - setIsFocused(false); - debouncedHideMovers(); - } - }; - /** - * Events are added via DOM events (vs. React synthetic events), - * as the child React components swallow mouse events. - */ - - - if (node && !registerRef.current) { - node.addEventListener('focus', handleOnFocus, true); - node.addEventListener('blur', handleOnBlur, true); - registerRef.current = true; - } - - return () => { - if (node) { - node.removeEventListener('focus', handleOnFocus); - node.removeEventListener('blur', handleOnBlur); - } - }; - }, [ref, registerRef, setIsFocused, debouncedShowMovers, debouncedHideMovers]); - return { - showMovers, - gestures: { - onMouseMove: debouncedShowMovers, - onMouseLeave: debouncedHideMovers - } - }; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-parent-selector/index.js - - - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - - - -/** - * Block parent selector component, displaying the hierarchy of the - * current block selection as a single icon to "go up" a level. - * - * @return {WPComponent} Parent block selector. - */ - -function BlockParentSelector() { - const { - selectBlock, - toggleBlockHighlight - } = Object(external_wp_data_["useDispatch"])(store); - const { - firstParentClientId, - shouldHide, - hasReducedUI - } = Object(external_wp_data_["useSelect"])(select => { - const { - getBlockName, - getBlockParents, - getSelectedBlockClientId, - getSettings - } = select(store); - const { - hasBlockSupport - } = select(external_wp_blocks_["store"]); - const selectedBlockClientId = getSelectedBlockClientId(); - const parents = getBlockParents(selectedBlockClientId); - const _firstParentClientId = parents[parents.length - 1]; - const parentBlockName = getBlockName(_firstParentClientId); - - const _parentBlockType = Object(external_wp_blocks_["getBlockType"])(parentBlockName); - - const settings = getSettings(); - return { - firstParentClientId: _firstParentClientId, - shouldHide: !hasBlockSupport(_parentBlockType, '__experimentalParentSelector', true), - hasReducedUI: settings.hasReducedUI - }; - }, []); - const blockInformation = useBlockDisplayInformation(firstParentClientId); // Allows highlighting the parent block outline when focusing or hovering - // the parent block selector within the child. - - const nodeRef = Object(external_wp_element_["useRef"])(); - const { - gestures: showMoversGestures - } = useShowMoversGestures({ - ref: nodeRef, - - onChange(isFocused) { - if (isFocused && hasReducedUI) { - return; - } - - toggleBlockHighlight(firstParentClientId, isFocused); - } - - }); - - if (shouldHide || firstParentClientId === undefined) { - return null; - } - - return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ - className: "block-editor-block-parent-selector", - key: firstParentClientId, - ref: nodeRef - }, showMoversGestures), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { - className: "block-editor-block-parent-selector__button", - onClick: () => selectBlock(firstParentClientId), - label: Object(external_wp_i18n_["sprintf"])( - /* translators: %s: Name of the block's parent. */ - Object(external_wp_i18n_["__"])('Select %s'), blockInformation.title), - showTooltip: true, - icon: Object(external_wp_element_["createElement"])(BlockIcon, { - icon: blockInformation.icon - }) - })); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/stack.js - - -/** - * WordPress dependencies - */ - -const stack_stack = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { - d: "M20.2 8v11c0 .7-.6 1.2-1.2 1.2H6v1.5h13c1.5 0 2.7-1.2 2.7-2.8V8zM18 16.4V4.6c0-.9-.7-1.6-1.6-1.6H4.6C3.7 3 3 3.7 3 4.6v11.8c0 .9.7 1.6 1.6 1.6h11.8c.9 0 1.6-.7 1.6-1.6zm-13.5 0V4.6c0-.1.1-.1.1-.1h11.8c.1 0 .1.1.1.1v11.8c0 .1-.1.1-.1.1H4.6l-.1-.1z" -})); -/* harmony default export */ var library_stack = (stack_stack); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/preview-block-popover.js - - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -function PreviewBlockPopover({ - blocks -}) { - return Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-switcher__popover__preview__parent" - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-switcher__popover__preview__container" - }, Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], { - className: "block-editor-block-switcher__preview__popover", - position: "bottom right", - focusOnMount: false - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-switcher__preview" - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-switcher__preview-title" - }, Object(external_wp_i18n_["__"])('Preview')), Object(external_wp_element_["createElement"])(block_preview, { - viewportWidth: 500, - blocks: blocks - }))))); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-transformations-menu.js - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - -const BlockTransformationsMenu = ({ - className, - possibleBlockTransformations, - onSelect, - blocks -}) => { - const [hoveredTransformItemName, setHoveredTransformItemName] = Object(external_wp_element_["useState"])(); - return Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], { - label: Object(external_wp_i18n_["__"])('Transform to'), - className: className - }, hoveredTransformItemName && Object(external_wp_element_["createElement"])(PreviewBlockPopover, { - blocks: Object(external_wp_blocks_["switchToBlockType"])(blocks, hoveredTransformItemName) - }), possibleBlockTransformations.map(item => { - const { - name, - icon, - title, - isDisabled - } = item; - return Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { - key: name, - className: Object(external_wp_blocks_["getBlockMenuDefaultClassName"])(name), - onClick: event => { - event.preventDefault(); - onSelect(name); - }, - disabled: isDisabled, - onMouseLeave: () => setHoveredTransformItemName(null), - onMouseEnter: () => setHoveredTransformItemName(name) - }, Object(external_wp_element_["createElement"])(BlockIcon, { - icon: icon, - showColors: true - }), title); - })); -}; - -/* harmony default export */ var block_transformations_menu = (BlockTransformationsMenu); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-styles/utils.js -/** - * External dependencies - */ - -/** - * WordPress 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) { - for (const style of new external_wp_tokenList_default.a(className).values()) { - if (style.indexOf('is-style-') === -1) { - continue; - } - - const potentialStyleName = style.substring(9); - const activeStyle = Object(external_lodash_["find"])(styles, { - name: potentialStyleName - }); - - if (activeStyle) { - return activeStyle; - } - } - - 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) { - const list = new external_wp_tokenList_default.a(className); - - if (activeStyle) { - list.remove('is-style-' + activeStyle.name); - } - - list.add('is-style-' + newStyle.name); - return list.value; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-styles/index.js - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - - -const EMPTY_OBJECT = {}; - -function useGenericPreviewBlock(block, type) { - return Object(external_wp_element_["useMemo"])(() => { - const example = type === null || type === void 0 ? void 0 : type.example; - const blockName = type === null || type === void 0 ? void 0 : type.name; - - if (example && blockName) { - return Object(external_wp_blocks_["getBlockFromExample"])(blockName, { - attributes: example.attributes, - innerBlocks: example.innerBlocks - }); - } - - if (block) { - return Object(external_wp_blocks_["cloneBlock"])(block); - } - }, [type !== null && type !== void 0 && type.example ? block === null || block === void 0 ? void 0 : block.name : block, type]); -} - -function BlockStyles({ - clientId, - onSwitch = external_lodash_["noop"], - onHoverClassName = external_lodash_["noop"], - itemRole -}) { - const selector = select => { - const { - getBlock - } = select(store); - const block = getBlock(clientId); - - if (!block) { - return EMPTY_OBJECT; - } - - const blockType = Object(external_wp_blocks_["getBlockType"])(block.name); - const { - getBlockStyles - } = select(external_wp_blocks_["store"]); - return { - block, - type: blockType, - styles: getBlockStyles(block.name), - className: block.attributes.className || '' - }; - }; - - const { - styles, - block, - type, - className - } = Object(external_wp_data_["useSelect"])(selector, [clientId]); - const { - updateBlockAttributes - } = Object(external_wp_data_["useDispatch"])(store); - const genericPreviewBlock = useGenericPreviewBlock(block, type); - - if (!styles || styles.length === 0) { - return null; - } - - const renderedStyles = Object(external_lodash_["find"])(styles, 'isDefault') ? styles : [{ - name: 'default', - label: Object(external_wp_i18n_["_x"])('Default', 'block style'), - isDefault: true - }, ...styles]; - const activeStyle = getActiveStyle(renderedStyles, className); - return Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-styles" - }, renderedStyles.map(style => { - const styleClassName = replaceActiveStyle(className, activeStyle, style); - return Object(external_wp_element_["createElement"])(BlockStyleItem, { - genericPreviewBlock: genericPreviewBlock, - className: className, - isActive: activeStyle === style, - key: style.name, - onSelect: () => { - updateBlockAttributes(clientId, { - className: styleClassName - }); - onHoverClassName(null); - onSwitch(); - }, - onBlur: () => onHoverClassName(null), - onHover: () => onHoverClassName(styleClassName), - style: style, - styleClassName: styleClassName, - itemRole: itemRole - }); - })); -} - -function BlockStyleItem({ - genericPreviewBlock, - style, - isActive, - onBlur, - onHover, - onSelect, - styleClassName, - itemRole -}) { - const previewBlocks = Object(external_wp_element_["useMemo"])(() => { - return { ...genericPreviewBlock, - attributes: { ...genericPreviewBlock.attributes, - className: styleClassName - } - }; - }, [genericPreviewBlock, styleClassName]); - return Object(external_wp_element_["createElement"])("div", { - key: style.name, - className: classnames_default()('block-editor-block-styles__item', { - 'is-active': isActive - }), - onClick: () => onSelect(), - onKeyDown: event => { - if (external_wp_keycodes_["ENTER"] === event.keyCode || external_wp_keycodes_["SPACE"] === event.keyCode) { - event.preventDefault(); - onSelect(); - } - }, - onMouseEnter: onHover, - onMouseLeave: onBlur, - role: itemRole || 'button', - tabIndex: "0", - "aria-label": style.label || style.name - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-styles__item-preview" - }, Object(external_wp_element_["createElement"])(block_preview, { - viewportWidth: 500, - blocks: previewBlocks - })), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-styles__item-label" - }, style.label || style.name)); -} - -/* harmony default export */ var block_styles = (BlockStyles); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-styles-menu.js - - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - -function BlockStylesMenu({ - hoveredBlock, - onSwitch -}) { - const { - name, - clientId - } = hoveredBlock; - const [hoveredClassName, setHoveredClassName] = Object(external_wp_element_["useState"])(); - const blockType = Object(external_wp_data_["useSelect"])(select => select(external_wp_blocks_["store"]).getBlockType(name), [name]); - return Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], { - label: Object(external_wp_i18n_["__"])('Styles'), - className: "block-editor-block-switcher__styles__menugroup" - }, hoveredClassName && Object(external_wp_element_["createElement"])(PreviewBlockPopover, { - blocks: blockType.example ? Object(external_wp_blocks_["getBlockFromExample"])(blockType.name, { - attributes: { ...blockType.example.attributes, - className: hoveredClassName - }, - innerBlocks: blockType.example.innerBlocks - }) : Object(external_wp_blocks_["cloneBlock"])(hoveredBlock, { - className: hoveredClassName - }) - }), Object(external_wp_element_["createElement"])(block_styles, { - clientId: clientId, - onSwitch: onSwitch, - onHoverClassName: setHoveredClassName, - itemRole: "menuitem" - })); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/utils.js -/** - * WordPress dependencies - */ - -/** - * Try to find a matching block by a block's name in a provided - * block. We recurse through InnerBlocks and return the reference - * of the matched block (it could be an InnerBlock). - * If no match is found return nothing. - * - * @param {WPBlock} block The block to try to find a match. - * @param {string} selectedBlockName The block's name to use for matching condition. - * @param {Set} consumedBlocks A set holding the previously matched/consumed blocks. - * - * @return {WPBlock?} The matched block if found or nothing(`undefined`). - */ - -const getMatchingBlockByName = (block, selectedBlockName, consumedBlocks = new Set()) => { - const { - clientId, - name, - innerBlocks = [] - } = block; // Check if block has been consumed already. - - if (consumedBlocks.has(clientId)) return; - if (name === selectedBlockName) return block; // Try to find a matching block from InnerBlocks recursively. - - for (const innerBlock of innerBlocks) { - const match = getMatchingBlockByName(innerBlock, selectedBlockName, consumedBlocks); - if (match) return match; - } -}; -/** - * Find and return the block attributes to retain through - * the transformation, based on Block Type's `role:content` - * attributes. If no `role:content` attributes exist, - * return selected block's attributes. - * - * @param {string} name Block type's namespaced name. - * @param {Object} attributes Selected block's attributes. - * @return {Object} The block's attributes to retain. - */ - -const getRetainedBlockAttributes = (name, attributes) => { - const contentAttributes = Object(external_wp_blocks_["__experimentalGetBlockAttributesNamesByRole"])(name, 'content'); - if (!(contentAttributes !== null && contentAttributes !== void 0 && contentAttributes.length)) return attributes; - return contentAttributes.reduce((_accumulator, attribute) => { - if (attributes[attribute]) _accumulator[attribute] = attributes[attribute]; - return _accumulator; - }, {}); -}; - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/use-transformed-patterns.js -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -/** - * Mutate the matched block's attributes by getting - * which block type's attributes to retain and prioritize - * them in the merging of the attributes. - * - * @param {WPBlock} match The matched block. - * @param {WPBlock} selectedBlock The selected block. - * @return {void} - */ - -const transformMatchingBlock = (match, selectedBlock) => { - // Get the block attributes to retain through the transformation. - const retainedBlockAttributes = getRetainedBlockAttributes(selectedBlock.name, selectedBlock.attributes); - match.attributes = { ...match.attributes, - ...retainedBlockAttributes - }; -}; -/** - * By providing the selected blocks and pattern's blocks - * find the matching blocks, transform them and return them. - * If not all selected blocks are matched, return nothing. - * - * @param {WPBlock[]} selectedBlocks The selected blocks. - * @param {WPBlock[]} patternBlocks The pattern's blocks. - * @return {WPBlock[]|void} The transformed pattern's blocks or undefined if not all selected blocks have been matched. - */ - -const getPatternTransformedBlocks = (selectedBlocks, patternBlocks) => { - // Clone Pattern's blocks to produce new clientIds and be able to mutate the matches. - const _patternBlocks = patternBlocks.map(block => Object(external_wp_blocks_["cloneBlock"])(block)); - /** - * Keep track of the consumed pattern blocks. - * This is needed because we loop the selected blocks - * and for example we may have selected two paragraphs and - * the pattern's blocks could have more `paragraphs`. - */ - - - const consumedBlocks = new Set(); - - for (const selectedBlock of selectedBlocks) { - let isMatch = false; - - for (const patternBlock of _patternBlocks) { - const match = getMatchingBlockByName(patternBlock, selectedBlock.name, consumedBlocks); - if (!match) continue; - isMatch = true; - consumedBlocks.add(match.clientId); // We update (mutate) the matching pattern block. - - transformMatchingBlock(match, selectedBlock); // No need to loop through other pattern's blocks. - - break; - } // Bail eary if a selected block has not been matched. - - - if (!isMatch) return; - } - - return _patternBlocks; -}; -/** - * @typedef {WPBlockPattern & {transformedBlocks: WPBlock[]}} TransformedBlockPattern - */ - -/** - * Custom hook that accepts patterns from state and the selected - * blocks and tries to match these with the pattern's blocks. - * If all selected blocks are matched with a Pattern's block, - * we transform them by retaining block's attributes with `role:content`. - * The transformed pattern's blocks are set to a new pattern - * property `transformedBlocks`. - * - * @param {WPBlockPattern[]} patterns Patterns from state. - * @param {WPBlock[]} selectedBlocks The currently selected blocks. - * @return {TransformedBlockPattern[]} Returns the eligible matched patterns with all the selected blocks. - */ -// TODO tests - -const useTransformedPatterns = (patterns, selectedBlocks) => { - return Object(external_wp_element_["useMemo"])(() => patterns.reduce((accumulator, _pattern) => { - const transformedBlocks = getPatternTransformedBlocks(selectedBlocks, _pattern.blocks); - - if (transformedBlocks) { - accumulator.push({ ..._pattern, - transformedBlocks - }); - } - - return accumulator; - }, []), [patterns, selectedBlocks]); -}; - -/* harmony default export */ var use_transformed_patterns = (useTransformedPatterns); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/pattern-transformations-menu.js - - - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - - -function PatternTransformationsMenu({ - blocks, - patterns: statePatterns, - onSelect -}) { - const [showTransforms, setShowTransforms] = Object(external_wp_element_["useState"])(false); - const patterns = use_transformed_patterns(statePatterns, blocks); - if (!patterns.length) return null; - return Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], { - className: "block-editor-block-switcher__pattern__transforms__menugroup" - }, showTransforms && Object(external_wp_element_["createElement"])(PreviewPatternsPopover, { - patterns: patterns, - onSelect: onSelect - }), Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { - onClick: event => { - event.preventDefault(); - setShowTransforms(!showTransforms); - }, - icon: chevron_right["a" /* default */] - }, Object(external_wp_i18n_["__"])('Patterns'))); -} - -function PreviewPatternsPopover({ - patterns, - onSelect -}) { - return Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-switcher__popover__preview__parent" - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-switcher__popover__preview__container" - }, Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], { - className: "block-editor-block-switcher__preview__popover", - position: "bottom right" - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-switcher__preview" - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-switcher__preview-title" - }, Object(external_wp_i18n_["__"])('Preview')), Object(external_wp_element_["createElement"])(BlockPatternsList, { - patterns: patterns, - onSelect: onSelect - }))))); -} - -function BlockPatternsList({ - patterns, - onSelect -}) { - const composite = Object(external_wp_components_["__unstableUseCompositeState"])(); - return Object(external_wp_element_["createElement"])(external_wp_components_["__unstableComposite"], Object(esm_extends["a" /* default */])({}, composite, { - role: "listbox", - className: "block-editor-block-switcher__preview-patterns-container", - "aria-label": Object(external_wp_i18n_["__"])('Patterns list') - }), patterns.map(pattern => Object(external_wp_element_["createElement"])(pattern_transformations_menu_BlockPattern, { - key: pattern.name, - pattern: pattern, - onSelect: onSelect, - composite: composite - }))); -} - -function pattern_transformations_menu_BlockPattern({ - pattern, - onSelect, - composite -}) { - // TODO check pattern/preview width... - const baseClassName = 'block-editor-block-switcher__preview-patterns-container'; - const descriptionId = Object(external_wp_compose_["useInstanceId"])(pattern_transformations_menu_BlockPattern, `${baseClassName}-list__item-description`); - return Object(external_wp_element_["createElement"])("div", { - className: `${baseClassName}-list__list-item`, - "aria-label": pattern.title, - "aria-describedby": pattern.description ? descriptionId : undefined - }, Object(external_wp_element_["createElement"])(external_wp_components_["__unstableCompositeItem"], Object(esm_extends["a" /* default */])({ - role: "option", - as: "div" - }, composite, { - className: `${baseClassName}-list__item`, - onClick: () => onSelect(pattern.transformedBlocks) - }), Object(external_wp_element_["createElement"])(block_preview, { - blocks: pattern.transformedBlocks, - viewportWidth: pattern.viewportWidth || 500 - }), Object(external_wp_element_["createElement"])("div", { - className: `${baseClassName}-list__item-title` - }, pattern.title)), !!pattern.description && Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { - id: descriptionId - }, pattern.description)); -} - -/* harmony default export */ var pattern_transformations_menu = (PatternTransformationsMenu); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/index.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - - - - - - -const BlockSwitcherDropdownMenu = ({ - clientIds, - blocks -}) => { - const { - replaceBlocks - } = Object(external_wp_data_["useDispatch"])(store); - const blockInformation = useBlockDisplayInformation(blocks[0].clientId); - const { - possibleBlockTransformations, - hasBlockStyles, - icon, - blockTitle, - patterns - } = Object(external_wp_data_["useSelect"])(select => { - const { - getBlockRootClientId, - getBlockTransformItems, - __experimentalGetPatternTransformItems - } = select(store); - const { - getBlockStyles, - getBlockType - } = select(external_wp_blocks_["store"]); - const rootClientId = getBlockRootClientId(Object(external_lodash_["castArray"])(clientIds)[0]); - const [{ - name: firstBlockName - }] = blocks; - - const _isSingleBlockSelected = blocks.length === 1; - - const styles = _isSingleBlockSelected && getBlockStyles(firstBlockName); - - let _icon; - - if (_isSingleBlockSelected) { - _icon = blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon; // Take into account active block variations. - } else { - var _getBlockType; - - const isSelectionOfSameType = Object(external_lodash_["uniq"])(blocks.map(({ - name - }) => name)).length === 1; // When selection consists of blocks of multiple types, display an - // appropriate icon to communicate the non-uniformity. - - _icon = isSelectionOfSameType ? (_getBlockType = getBlockType(firstBlockName)) === null || _getBlockType === void 0 ? void 0 : _getBlockType.icon : library_stack; - } - - return { - possibleBlockTransformations: getBlockTransformItems(blocks, rootClientId), - hasBlockStyles: !!(styles !== null && styles !== void 0 && styles.length), - icon: _icon, - blockTitle: getBlockType(firstBlockName).title, - patterns: __experimentalGetPatternTransformItems(blocks, rootClientId) - }; - }, [clientIds, blocks, blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon]); - const isReusable = blocks.length === 1 && Object(external_wp_blocks_["isReusableBlock"])(blocks[0]); - const isTemplate = blocks.length === 1 && Object(external_wp_blocks_["isTemplatePart"])(blocks[0]); // Simple block tranformation based on the `Block Transforms` API. - - const onBlockTransform = name => replaceBlocks(clientIds, Object(external_wp_blocks_["switchToBlockType"])(blocks, name)); // Pattern transformation through the `Patterns` API. - - - const onPatternTransform = transformedBlocks => replaceBlocks(clientIds, transformedBlocks); - - const hasPossibleBlockTransformations = !!possibleBlockTransformations.length; - const hasPatternTransformation = !!(patterns !== null && patterns !== void 0 && patterns.length); - - if (!hasBlockStyles && !hasPossibleBlockTransformations) { - return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { - disabled: true, - className: "block-editor-block-switcher__no-switcher-icon", - title: blockTitle, - icon: Object(external_wp_element_["createElement"])(BlockIcon, { - icon: icon, - showColors: true - }) - })); - } - - const blockSwitcherLabel = blockTitle; - const blockSwitcherDescription = 1 === blocks.length ? Object(external_wp_i18n_["sprintf"])( - /* translators: %s: block title. */ - Object(external_wp_i18n_["__"])('%s: Change block type or style'), blockTitle) : Object(external_wp_i18n_["sprintf"])( - /* translators: %d: number of blocks. */ - Object(external_wp_i18n_["_n"])('Change type of %d block', 'Change type of %d blocks', blocks.length), blocks.length); - const showDropDown = hasBlockStyles || hasPossibleBlockTransformations || hasPatternTransformation; - return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], null, toggleProps => Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], { - className: "block-editor-block-switcher", - label: blockSwitcherLabel, - popoverProps: { - position: 'bottom right', - isAlternate: true, - className: 'block-editor-block-switcher__popover' - }, - icon: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(BlockIcon, { - icon: icon, - className: "block-editor-block-switcher__toggle", - showColors: true - }), (isReusable || isTemplate) && Object(external_wp_element_["createElement"])("span", { - className: "block-editor-block-switcher__toggle-text" - }, Object(external_wp_element_["createElement"])(BlockTitle, { - clientId: clientIds - }))), - toggleProps: { - describedBy: blockSwitcherDescription, - ...toggleProps - }, - menuProps: { - orientation: 'both' - } - }, ({ - onClose - }) => showDropDown && Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-switcher__container" - }, hasPatternTransformation && Object(external_wp_element_["createElement"])(pattern_transformations_menu, { - blocks: blocks, - patterns: patterns, - onSelect: transformedBlocks => { - onPatternTransform(transformedBlocks); - onClose(); - } - }), hasPossibleBlockTransformations && Object(external_wp_element_["createElement"])(block_transformations_menu, { - className: "block-editor-block-switcher__transforms__menugroup", - possibleBlockTransformations: possibleBlockTransformations, - blocks: blocks, - onSelect: name => { - onBlockTransform(name); - onClose(); - } - }), hasBlockStyles && Object(external_wp_element_["createElement"])(BlockStylesMenu, { - hoveredBlock: blocks[0], - onSwitch: onClose - }))))); -}; -const BlockSwitcher = ({ - clientIds -}) => { - const blocks = Object(external_wp_data_["useSelect"])(select => select(store).getBlocksByClientId(clientIds), [clientIds]); - - if (!blocks.length || blocks.some(block => !block)) { - return null; - } - - return Object(external_wp_element_["createElement"])(BlockSwitcherDropdownMenu, { - clientIds: clientIds, - blocks: blocks - }); -}; -/* harmony default export */ var block_switcher = (BlockSwitcher); - -// EXTERNAL MODULE: external ["wp","blob"] -var external_wp_blob_ = __webpack_require__("xTGt"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/get-paste-event-data.js -/** - * WordPress dependencies - */ - - -function getPasteEventData({ - clipboardData -}) { - let plainText = ''; - let 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; - } - } - - const files = Object(external_wp_dom_["getFilesFromDataTransfer"])(clipboardData).filter(({ - type - }) => /^image\/(?:jpe?g|png|gif)$/.test(type)); // Only process files if no HTML is present. - // A pasted file may have the URL as plain text. - - if (files.length && !html) { - html = files.map(file => ``).join(''); - plainText = ''; - } - - return { - html, - plainText - }; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/copy-handler/index.js - - -/** - * WordPress dependencies - */ - - - - - - - -/** - * Internal dependencies - */ - - - -function useNotifyCopy() { - const { - getBlockName - } = Object(external_wp_data_["useSelect"])(store); - const { - getBlockType - } = Object(external_wp_data_["useSelect"])(external_wp_blocks_["store"]); - const { - createSuccessNotice - } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]); - return Object(external_wp_element_["useCallback"])((eventType, selectedBlockClientIds) => { - let notice = ''; - - if (selectedBlockClientIds.length === 1) { - const clientId = selectedBlockClientIds[0]; - const { - title - } = getBlockType(getBlockName(clientId)); - notice = eventType === 'copy' ? Object(external_wp_i18n_["sprintf"])( // Translators: Name of the block being copied, e.g. "Paragraph". - Object(external_wp_i18n_["__"])('Copied "%s" to clipboard.'), title) : Object(external_wp_i18n_["sprintf"])( // Translators: Name of the block being cut, e.g. "Paragraph". - Object(external_wp_i18n_["__"])('Moved "%s" to clipboard.'), title); - } else { - notice = eventType === 'copy' ? Object(external_wp_i18n_["sprintf"])( // Translators: %d: Number of blocks being copied. - Object(external_wp_i18n_["_n"])('Copied %d block to clipboard.', 'Copied %d blocks to clipboard.', selectedBlockClientIds.length), selectedBlockClientIds.length) : Object(external_wp_i18n_["sprintf"])( // Translators: %d: Number of blocks being cut. - Object(external_wp_i18n_["_n"])('Moved %d block to clipboard.', 'Moved %d blocks to clipboard.', selectedBlockClientIds.length), selectedBlockClientIds.length); - } - - createSuccessNotice(notice, { - type: 'snackbar' - }); - }, []); -} -function useClipboardHandler() { - const { - getBlocksByClientId, - getSelectedBlockClientIds, - hasMultiSelection, - getSettings - } = Object(external_wp_data_["useSelect"])(store); - const { - flashBlock, - removeBlocks, - replaceBlocks - } = Object(external_wp_data_["useDispatch"])(store); - const notifyCopy = useNotifyCopy(); - return Object(external_wp_compose_["useRefEffect"])(node => { - function handler(event) { - const selectedBlockClientIds = getSelectedBlockClientIds(); - - if (selectedBlockClientIds.length === 0) { - return; - } // Always handle multiple selected blocks. - - - if (!hasMultiSelection()) { - const { - target - } = event; - const { - ownerDocument - } = target; // If copying, only consider actual text selection as selection. - // Otherwise, any focus on an input field is considered. - - const hasSelection = event.type === 'copy' || event.type === 'cut' ? Object(external_wp_dom_["documentHasUncollapsedSelection"])(ownerDocument) : Object(external_wp_dom_["documentHasSelection"])(ownerDocument); // Let native copy behaviour take over in input fields. - - if (hasSelection) { - return; - } - } - - if (!node.contains(event.target.ownerDocument.activeElement)) { - return; - } - - event.preventDefault(); - - if (event.type === 'copy' || event.type === 'cut') { - if (selectedBlockClientIds.length === 1) { - flashBlock(selectedBlockClientIds[0]); - } - - notifyCopy(event.type, selectedBlockClientIds); - const blocks = getBlocksByClientId(selectedBlockClientIds); - const serialized = Object(external_wp_blocks_["serialize"])(blocks); - event.clipboardData.setData('text/plain', serialized); - event.clipboardData.setData('text/html', serialized); - } - - if (event.type === 'cut') { - removeBlocks(selectedBlockClientIds); - } else if (event.type === 'paste') { - const { - __experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML - } = getSettings(); - const { - plainText, - html - } = getPasteEventData(event); - const blocks = Object(external_wp_blocks_["pasteHandler"])({ - HTML: html, - plainText, - mode: 'BLOCKS', - canUserUseUnfilteredHTML - }); - replaceBlocks(selectedBlockClientIds, blocks, blocks.length - 1, -1); - } - } - - node.ownerDocument.addEventListener('copy', handler); - node.ownerDocument.addEventListener('cut', handler); - node.ownerDocument.addEventListener('paste', handler); - return () => { - node.ownerDocument.removeEventListener('copy', handler); - node.ownerDocument.removeEventListener('cut', handler); - node.ownerDocument.removeEventListener('paste', handler); - }; - }, []); -} - -function CopyHandler({ - children -}) { - return Object(external_wp_element_["createElement"])("div", { - ref: useClipboardHandler() - }, children); -} - -/* harmony default export */ var copy_handler = (CopyHandler); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-actions/index.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - -function BlockActions({ - clientIds, - children, - __experimentalUpdateSelection: updateSelection -}) { - const { - canInsertBlockType, - getBlockRootClientId, - getBlocksByClientId, - getTemplateLock - } = Object(external_wp_data_["useSelect"])(select => select(store), []); - const { - getDefaultBlockName, - getGroupingBlockName - } = Object(external_wp_data_["useSelect"])(select => select(external_wp_blocks_["store"]), []); - const blocks = getBlocksByClientId(clientIds); - const rootClientId = getBlockRootClientId(clientIds[0]); - const canDuplicate = Object(external_lodash_["every"])(blocks, block => { - return !!block && Object(external_wp_blocks_["hasBlockSupport"])(block.name, 'multiple', true) && canInsertBlockType(block.name, rootClientId); - }); - const canInsertDefaultBlock = canInsertBlockType(getDefaultBlockName(), rootClientId); - const { - removeBlocks, - replaceBlocks, - duplicateBlocks, - insertAfterBlock, - insertBeforeBlock, - flashBlock, - setBlockMovingClientId, - setNavigationMode, - selectBlock - } = Object(external_wp_data_["useDispatch"])(store); - const notifyCopy = useNotifyCopy(); - return children({ - canDuplicate, - canInsertDefaultBlock, - isLocked: !!getTemplateLock(rootClientId), - rootClientId, - blocks, - - onDuplicate() { - return duplicateBlocks(clientIds, updateSelection); - }, - - onRemove() { - return removeBlocks(clientIds, updateSelection); - }, - - onInsertBefore() { - insertBeforeBlock(Object(external_lodash_["first"])(Object(external_lodash_["castArray"])(clientIds))); - }, - - onInsertAfter() { - insertAfterBlock(Object(external_lodash_["last"])(Object(external_lodash_["castArray"])(clientIds))); - }, - - onMoveTo() { - setNavigationMode(true); - selectBlock(clientIds[0]); - setBlockMovingClientId(clientIds[0]); - }, - - onGroup() { - if (!blocks.length) { - return; - } - - const groupingBlockName = getGroupingBlockName(); // Activate the `transform` on `core/group` which does the conversion - - const newBlocks = Object(external_wp_blocks_["switchToBlockType"])(blocks, groupingBlockName); - - if (!newBlocks) { - return; - } - - replaceBlocks(clientIds, newBlocks); - }, - - onUngroup() { - if (!blocks.length) { - return; - } - - const innerBlocks = blocks[0].innerBlocks; - - if (!innerBlocks.length) { - return; - } - - replaceBlocks(clientIds, innerBlocks); - }, - - onCopy() { - const selectedBlockClientIds = blocks.map(({ - clientId - }) => clientId); - - if (blocks.length === 1) { - flashBlock(selectedBlockClientIds[0]); - } - - notifyCopy('copy', selectedBlockClientIds); - } - - }); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-mode-toggle.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - -function BlockModeToggle({ - blockType, - mode, - onToggleMode, - small = false, - isCodeEditingEnabled = true -}) { - if (!Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'html', true) || !isCodeEditingEnabled) { - return null; - } - - const label = mode === 'visual' ? Object(external_wp_i18n_["__"])('Edit as HTML') : Object(external_wp_i18n_["__"])('Edit visually'); - return Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { - onClick: onToggleMode - }, !small && label); -} -/* harmony default export */ var block_mode_toggle = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, { - clientId -}) => { - const { - getBlock, - getBlockMode, - getSettings - } = select(store); - const block = getBlock(clientId); - const isCodeEditingEnabled = getSettings().codeEditingEnabled; - return { - mode: getBlockMode(clientId), - blockType: block ? Object(external_wp_blocks_["getBlockType"])(block.name) : null, - isCodeEditingEnabled - }; -}), Object(external_wp_data_["withDispatch"])((dispatch, { - onToggle = external_lodash_["noop"], - clientId -}) => ({ - onToggleMode() { - dispatch(store).toggleBlockMode(clientId); - onToggle(); - } - -}))])(BlockModeToggle)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-convert-button.js - - -/** - * WordPress dependencies - */ - - -function BlockConvertButton({ - shouldRender, - onClick, - small -}) { - if (!shouldRender) { - return null; - } - - const label = Object(external_wp_i18n_["__"])('Convert to Blocks'); - - return Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { - onClick: onClick - }, !small && label); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-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_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])((select, { - clientId -}) => { - const block = select(store).getBlock(clientId); - return { - block, - shouldRender: block && block.name === 'core/html' - }; -}), Object(external_wp_data_["withDispatch"])((dispatch, { - block -}) => ({ - onClick: () => dispatch(store).replaceBlocks(block.clientId, Object(external_wp_blocks_["rawHandler"])({ - HTML: Object(external_wp_blocks_["getBlockContent"])(block) - })) -})))(BlockConvertButton)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-settings-menu-first-item.js -/** - * WordPress dependencies - */ - -const { - Fill: __unstableBlockSettingsMenuFirstItem, - Slot: block_settings_menu_first_item_Slot -} = Object(external_wp_components_["createSlotFill"])('__unstableBlockSettingsMenuFirstItem'); -__unstableBlockSettingsMenuFirstItem.Slot = block_settings_menu_first_item_Slot; -/* harmony default export */ var block_settings_menu_first_item = (__unstableBlockSettingsMenuFirstItem); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -/** - * Contains the properties `ConvertToGroupButton` component needs. - * - * @typedef {Object} ConvertToGroupButtonProps - * @property {string[]} clientIds An array of the selected client ids. - * @property {boolean} isGroupable Indicates if the selected blocks can be grouped. - * @property {boolean} isUngroupable Indicates if the selected blocks can be ungrouped. - * @property {WPBlock[]} blocksSelection An array of the selected blocks. - * @property {string} groupingBlockName The name of block used for handling grouping interactions. - */ - -/** - * Returns the properties `ConvertToGroupButton` component needs to work properly. - * It is used in `BlockSettingsMenuControls` to know if `ConvertToGroupButton` - * should be rendered, to avoid ending up with an empty MenuGroup. - * - * @return {ConvertToGroupButtonProps} Returns the properties needed by `ConvertToGroupButton`. - */ - -function useConvertToGroupButtonProps() { - const { - clientIds, - isGroupable, - isUngroupable, - blocksSelection, - groupingBlockName - } = Object(external_wp_data_["useSelect"])(select => { - var _blocksSelection$; - - const { - getBlockRootClientId, - getBlocksByClientId, - canInsertBlockType, - getSelectedBlockClientIds - } = select(store); - const { - getGroupingBlockName - } = select(external_wp_blocks_["store"]); - - const _clientIds = getSelectedBlockClientIds(); - - const _groupingBlockName = getGroupingBlockName(); - - const rootClientId = !!(_clientIds !== null && _clientIds !== void 0 && _clientIds.length) ? getBlockRootClientId(_clientIds[0]) : undefined; - const groupingBlockAvailable = canInsertBlockType(_groupingBlockName, rootClientId); - - const _blocksSelection = getBlocksByClientId(_clientIds); - - const isSingleGroupingBlock = _blocksSelection.length === 1 && ((_blocksSelection$ = _blocksSelection[0]) === null || _blocksSelection$ === void 0 ? void 0 : _blocksSelection$.name) === _groupingBlockName; // Do we have - // 1. Grouping block available to be inserted? - // 2. One or more blocks selected - // (we allow single Blocks to become groups unless - // they are a soltiary group block themselves) - - const _isGroupable = groupingBlockAvailable && _blocksSelection.length && !isSingleGroupingBlock; // Do we have a single Group Block selected and does that group have inner blocks? - - - const _isUngroupable = isSingleGroupingBlock && !!_blocksSelection[0].innerBlocks.length; - - return { - clientIds: _clientIds, - isGroupable: _isGroupable, - isUngroupable: _isUngroupable, - blocksSelection: _blocksSelection, - groupingBlockName: _groupingBlockName - }; - }, []); - return { - clientIds, - isGroupable, - isUngroupable, - blocksSelection, - groupingBlockName - }; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/index.js - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - -function ConvertToGroupButton({ - clientIds, - isGroupable, - isUngroupable, - blocksSelection, - groupingBlockName, - onClose = () => {} -}) { - const { - replaceBlocks - } = Object(external_wp_data_["useDispatch"])(store); - - const onConvertToGroup = () => { - // Activate the `transform` on the Grouping Block which does the conversion - const newBlocks = Object(external_wp_blocks_["switchToBlockType"])(blocksSelection, groupingBlockName); - - if (newBlocks) { - replaceBlocks(clientIds, newBlocks); - } - }; - - const onConvertFromGroup = () => { - const innerBlocks = blocksSelection[0].innerBlocks; - - if (!innerBlocks.length) { - return; - } - - replaceBlocks(clientIds, innerBlocks); - }; - - if (!isGroupable && !isUngroupable) { - return null; - } - - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, isGroupable && Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { - onClick: () => { - onConvertToGroup(); - onClose(); - } - }, Object(external_wp_i18n_["_x"])('Group', 'verb')), isUngroupable && Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { - onClick: () => { - onConvertFromGroup(); - onClose(); - } - }, Object(external_wp_i18n_["_x"])('Ungroup', 'Ungrouping blocks from within a Group block back into individual blocks within the Editor '))); -} - - - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu-controls/index.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - -const { - Fill: block_settings_menu_controls_Fill, - Slot: block_settings_menu_controls_Slot -} = Object(external_wp_components_["createSlotFill"])('BlockSettingsMenuControls'); - -const BlockSettingsMenuControlsSlot = ({ - fillProps, - clientIds = null -}) => { - const selectedBlocks = Object(external_wp_data_["useSelect"])(select => { - const { - getBlocksByClientId, - getSelectedBlockClientIds - } = select(store); - const ids = clientIds !== null ? clientIds : getSelectedBlockClientIds(); - return Object(external_lodash_["map"])(Object(external_lodash_["compact"])(getBlocksByClientId(ids)), block => block.name); - }, [clientIds]); // Check if current selection of blocks is Groupable or Ungroupable - // and pass this props down to ConvertToGroupButton. - - const convertToGroupButtonProps = useConvertToGroupButtonProps(); - const { - isGroupable, - isUngroupable - } = convertToGroupButtonProps; - const showConvertToGroupButton = isGroupable || isUngroupable; - return Object(external_wp_element_["createElement"])(block_settings_menu_controls_Slot, { - fillProps: { ...fillProps, - selectedBlocks - } - }, fills => { - if ((fills === null || fills === void 0 ? void 0 : fills.length) > 0 || showConvertToGroupButton) { - return Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], null, fills, Object(external_wp_element_["createElement"])(ConvertToGroupButton, Object(esm_extends["a" /* default */])({}, convertToGroupButtonProps, { - onClose: fillProps === null || fillProps === void 0 ? void 0 : fillProps.onClose - }))); - } - }); -}; -/** - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-settings-menu-controls/README.md - * - * @param {Object} props Fill props. - * @return {WPElement} Element. - */ - - -function BlockSettingsMenuControls({ ...props -}) { - return Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalStyleProvider"], { - document: document - }, Object(external_wp_element_["createElement"])(block_settings_menu_controls_Fill, props)); -} - -BlockSettingsMenuControls.Slot = BlockSettingsMenuControlsSlot; -/* harmony default export */ var block_settings_menu_controls = (BlockSettingsMenuControls); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-settings-dropdown.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - - - - -/** - * Internal dependencies - */ - - - - - - -const block_settings_dropdown_POPOVER_PROPS = { - className: 'block-editor-block-settings-menu__popover', - position: 'bottom right', - isAlternate: true -}; - -function CopyMenuItem({ - blocks, - onCopy -}) { - const ref = Object(external_wp_compose_["useCopyToClipboard"])(() => Object(external_wp_blocks_["serialize"])(blocks), onCopy); - return Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { - ref: ref - }, Object(external_wp_i18n_["__"])('Copy')); -} - -function BlockSettingsDropdown({ - clientIds, - __experimentalSelectBlock, - children, - ...props -}) { - const blockClientIds = Object(external_lodash_["castArray"])(clientIds); - const count = blockClientIds.length; - const firstBlockClientId = blockClientIds[0]; - const shortcuts = Object(external_wp_data_["useSelect"])(select => { - const { - getShortcutRepresentation - } = select(external_wp_keyboardShortcuts_["store"]); - return { - duplicate: getShortcutRepresentation('core/block-editor/duplicate'), - remove: getShortcutRepresentation('core/block-editor/remove'), - insertAfter: getShortcutRepresentation('core/block-editor/insert-after'), - insertBefore: getShortcutRepresentation('core/block-editor/insert-before') - }; - }, []); - const updateSelection = Object(external_wp_element_["useCallback"])(__experimentalSelectBlock ? async clientIdsPromise => { - const ids = await clientIdsPromise; - - if (ids && ids[0]) { - __experimentalSelectBlock(ids[0]); - } - } : external_lodash_["noop"], [__experimentalSelectBlock]); - const removeBlockLabel = count === 1 ? Object(external_wp_i18n_["__"])('Remove block') : Object(external_wp_i18n_["__"])('Remove blocks'); - return Object(external_wp_element_["createElement"])(BlockActions, { - clientIds: clientIds, - __experimentalUpdateSelection: !__experimentalSelectBlock - }, ({ - canDuplicate, - canInsertDefaultBlock, - isLocked, - onDuplicate, - onInsertAfter, - onInsertBefore, - onRemove, - onCopy, - onMoveTo, - blocks - }) => Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], Object(esm_extends["a" /* default */])({ - icon: more_vertical["a" /* default */], - label: Object(external_wp_i18n_["__"])('Options'), - className: "block-editor-block-settings-menu", - popoverProps: block_settings_dropdown_POPOVER_PROPS, - noIcons: true - }, props), ({ - onClose - }) => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], null, Object(external_wp_element_["createElement"])(block_settings_menu_first_item.Slot, { - fillProps: { - onClose - } - }), count === 1 && Object(external_wp_element_["createElement"])(block_html_convert_button, { - clientId: firstBlockClientId - }), Object(external_wp_element_["createElement"])(CopyMenuItem, { - blocks: blocks, - onCopy: onCopy - }), canDuplicate && Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { - onClick: Object(external_lodash_["flow"])(onClose, onDuplicate, updateSelection), - shortcut: shortcuts.duplicate - }, Object(external_wp_i18n_["__"])('Duplicate')), canInsertDefaultBlock && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { - onClick: Object(external_lodash_["flow"])(onClose, onInsertBefore), - shortcut: shortcuts.insertBefore - }, Object(external_wp_i18n_["__"])('Insert before')), Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { - onClick: Object(external_lodash_["flow"])(onClose, onInsertAfter), - shortcut: shortcuts.insertAfter - }, Object(external_wp_i18n_["__"])('Insert after'))), !isLocked && Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { - onClick: Object(external_lodash_["flow"])(onClose, onMoveTo) - }, Object(external_wp_i18n_["__"])('Move to')), count === 1 && Object(external_wp_element_["createElement"])(block_mode_toggle, { - clientId: firstBlockClientId, - onToggle: onClose - })), Object(external_wp_element_["createElement"])(block_settings_menu_controls.Slot, { - fillProps: { - onClose - }, - clientIds: clientIds - }), typeof children === 'function' ? children({ - onClose - }) : external_wp_element_["Children"].map(child => Object(external_wp_element_["cloneElement"])(child, { - onClose - })), Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], null, !isLocked && Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { - onClick: Object(external_lodash_["flow"])(onClose, onRemove, updateSelection), - shortcut: shortcuts.remove - }, removeBlockLabel))))); -} -/* harmony default export */ var block_settings_dropdown = (BlockSettingsDropdown); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/index.js - - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - -function BlockSettingsMenu({ - clientIds, - ...props -}) { - return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], null, toggleProps => Object(external_wp_element_["createElement"])(block_settings_dropdown, Object(esm_extends["a" /* default */])({ - clientIds: clientIds, - toggleProps: toggleProps - }, props)))); -} -/* harmony default export */ var block_settings_menu = (BlockSettingsMenu); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/index.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - - - - - - -function BlockToolbar({ - hideDragHandle -}) { - const { - blockClientIds, - blockClientId, - blockType, - hasFixedToolbar, - hasReducedUI, - isValid, - isVisual - } = Object(external_wp_data_["useSelect"])(select => { - const { - getBlockName, - getBlockMode, - getSelectedBlockClientIds, - isBlockValid, - getBlockRootClientId, - getSettings - } = select(store); - const selectedBlockClientIds = getSelectedBlockClientIds(); - const selectedBlockClientId = selectedBlockClientIds[0]; - const blockRootClientId = getBlockRootClientId(selectedBlockClientId); - const settings = getSettings(); - return { - blockClientIds: selectedBlockClientIds, - blockClientId: selectedBlockClientId, - blockType: selectedBlockClientId && Object(external_wp_blocks_["getBlockType"])(getBlockName(selectedBlockClientId)), - hasFixedToolbar: settings.hasFixedToolbar, - hasReducedUI: settings.hasReducedUI, - rootClientId: blockRootClientId, - isValid: selectedBlockClientIds.every(id => isBlockValid(id)), - isVisual: selectedBlockClientIds.every(id => getBlockMode(id) === 'visual') - }; - }, []); // Handles highlighting the current block outline on hover or focus of the - // block type toolbar area. - - const { - toggleBlockHighlight - } = Object(external_wp_data_["useDispatch"])(store); - const nodeRef = Object(external_wp_element_["useRef"])(); - const { - showMovers, - gestures: showMoversGestures - } = useShowMoversGestures({ - ref: nodeRef, - - onChange(isFocused) { - if (isFocused && hasReducedUI) { - return; - } - - toggleBlockHighlight(blockClientId, isFocused); - } - - }); // Account for the cases where the block toolbar is rendered within the - // header area and not contextually to the block. - - const displayHeaderToolbar = Object(external_wp_compose_["useViewportMatch"])('medium', '<') || hasFixedToolbar; - - if (blockType) { - if (!Object(external_wp_blocks_["hasBlockSupport"])(blockType, '__experimentalToolbar', true)) { - return null; - } - } - - const shouldShowMovers = displayHeaderToolbar || showMovers; - - if (blockClientIds.length === 0) { - return null; - } - - const shouldShowVisualToolbar = isValid && isVisual; - const isMultiToolbar = blockClientIds.length > 1; - const classes = classnames_default()('block-editor-block-toolbar', shouldShowMovers && 'is-showing-movers'); - return Object(external_wp_element_["createElement"])("div", { - className: classes - }, !isMultiToolbar && !displayHeaderToolbar && Object(external_wp_element_["createElement"])(BlockParentSelector, { - clientIds: blockClientIds - }), Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ - ref: nodeRef - }, showMoversGestures), (shouldShowVisualToolbar || isMultiToolbar) && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], { - className: "block-editor-block-toolbar__block-controls" - }, Object(external_wp_element_["createElement"])(block_switcher, { - clientIds: blockClientIds - }), Object(external_wp_element_["createElement"])(block_mover, { - clientIds: blockClientIds, - hideDragHandle: hideDragHandle || hasReducedUI - }))), shouldShowVisualToolbar && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(block_controls.Slot, { - group: "block", - className: "block-editor-block-toolbar__slot" - }), Object(external_wp_element_["createElement"])(block_controls.Slot, { - className: "block-editor-block-toolbar__slot" - }), Object(external_wp_element_["createElement"])(block_controls.Slot, { - group: "inline", - className: "block-editor-block-toolbar__slot" - }), Object(external_wp_element_["createElement"])(block_controls.Slot, { - group: "other", - className: "block-editor-block-toolbar__slot" - })), Object(external_wp_element_["createElement"])(block_settings_menu, { - clientIds: blockClientIds - })); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/block-contextual-toolbar.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - - -function BlockContextualToolbar({ - focusOnMount, - isFixed, - ...props -}) { - const { - blockType, - hasParents, - showParentSelector - } = Object(external_wp_data_["useSelect"])(select => { - const { - getBlockName, - getBlockParents, - getSelectedBlockClientIds - } = select(store); - const { - getBlockType - } = select(external_wp_blocks_["store"]); - const selectedBlockClientIds = getSelectedBlockClientIds(); - const selectedBlockClientId = selectedBlockClientIds[0]; - const parents = getBlockParents(selectedBlockClientId); - const firstParentClientId = parents[parents.length - 1]; - const parentBlockName = getBlockName(firstParentClientId); - const parentBlockType = getBlockType(parentBlockName); - return { - blockType: selectedBlockClientId && getBlockType(getBlockName(selectedBlockClientId)), - hasParents: parents.length, - showParentSelector: Object(external_wp_blocks_["hasBlockSupport"])(parentBlockType, '__experimentalParentSelector', true) - }; - }, []); - - if (blockType) { - if (!Object(external_wp_blocks_["hasBlockSupport"])(blockType, '__experimentalToolbar', true)) { - return null; - } - } // Shifts the toolbar to make room for the parent block selector. - - - const classes = classnames_default()('block-editor-block-contextual-toolbar', { - 'has-parent': hasParents && showParentSelector, - 'is-fixed': isFixed - }); - return Object(external_wp_element_["createElement"])(navigable_toolbar, Object(esm_extends["a" /* default */])({ - focusOnMount: focusOnMount, - className: classes - /* translators: accessibility text for the block toolbar */ - , - "aria-label": Object(external_wp_i18n_["__"])('Block tools') - }, props), Object(external_wp_element_["createElement"])(BlockToolbar, { - hideDragHandle: isFixed - })); -} - -/* harmony default export */ var block_contextual_toolbar = (BlockContextualToolbar); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/block-popover.js - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - - - - - -/** - * Internal dependencies - */ - - - - - - - - -function block_popover_selector(select) { - const { - isNavigationMode, - isMultiSelecting, - hasMultiSelection, - isTyping, - isCaretWithinFormattedText, - getSettings, - getLastMultiSelectedBlockClientId - } = select(store); - return { - isNavigationMode: isNavigationMode(), - isMultiSelecting: isMultiSelecting(), - isTyping: isTyping(), - isCaretWithinFormattedText: isCaretWithinFormattedText(), - hasMultiSelection: hasMultiSelection(), - hasFixedToolbar: getSettings().hasFixedToolbar, - lastClientId: getLastMultiSelectedBlockClientId() - }; -} - -function BlockPopover({ - clientId, - rootClientId, - isValid, - isEmptyDefaultBlock, - capturingClientId, - __unstablePopoverSlot, - __unstableContentRef -}) { - const { - isNavigationMode, - isMultiSelecting, - isTyping, - isCaretWithinFormattedText, - hasMultiSelection, - hasFixedToolbar, - lastClientId - } = Object(external_wp_data_["useSelect"])(block_popover_selector, []); - const isInsertionPointVisible = Object(external_wp_data_["useSelect"])(select => { - const { - isBlockInsertionPointVisible, - getBlockInsertionPoint, - getBlockOrder - } = select(store); - - if (!isBlockInsertionPointVisible()) { - return false; - } - - const insertionPoint = getBlockInsertionPoint(); - const order = getBlockOrder(insertionPoint.rootClientId); - return order[insertionPoint.index] === clientId; - }, [clientId]); - const isLargeViewport = Object(external_wp_compose_["useViewportMatch"])('medium'); - const [isToolbarForced, setIsToolbarForced] = Object(external_wp_element_["useState"])(false); - const [isInserterShown, setIsInserterShown] = Object(external_wp_element_["useState"])(false); - const { - stopTyping - } = Object(external_wp_data_["useDispatch"])(store); // Controls when the side inserter on empty lines should - // be shown, including writing and selection modes. - - const showEmptyBlockSideInserter = !isTyping && !isNavigationMode && isEmptyDefaultBlock && isValid; - const shouldShowBreadcrumb = isNavigationMode; - const shouldShowContextualToolbar = !isNavigationMode && !hasFixedToolbar && isLargeViewport && !showEmptyBlockSideInserter && !isMultiSelecting && (!isTyping || isCaretWithinFormattedText); - const canFocusHiddenToolbar = !isNavigationMode && !shouldShowContextualToolbar && !hasFixedToolbar && !isEmptyDefaultBlock; - Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/focus-toolbar', Object(external_wp_element_["useCallback"])(() => { - setIsToolbarForced(true); - stopTyping(true); - }, []), { - bindGlobal: true, - eventName: 'keydown', - isDisabled: !canFocusHiddenToolbar - }); - Object(external_wp_element_["useEffect"])(() => { - if (!shouldShowContextualToolbar) { - setIsToolbarForced(false); - } - }, [shouldShowContextualToolbar]); // Stores the active toolbar item index so the block toolbar can return focus - // to it when re-mounting. - - const initialToolbarItemIndexRef = Object(external_wp_element_["useRef"])(); - const selectedElement = useBlockElement(clientId); - const lastSelectedElement = useBlockElement(lastClientId); - const capturingElement = useBlockElement(capturingClientId); - const popoverScrollRef = usePopoverScroll(__unstableContentRef); - - if (!shouldShowBreadcrumb && !shouldShowContextualToolbar && !isToolbarForced && !showEmptyBlockSideInserter) { - return null; - } - - let node = selectedElement; - - if (!node) { - return null; - } - - if (capturingClientId) { - node = capturingElement; - } - - let anchorRef = node; - - if (hasMultiSelection) { - // Wait to render the popover until the bottom reference is available - // as well. - if (!lastSelectedElement) { - return null; - } - - anchorRef = { - top: node, - bottom: lastSelectedElement - }; - } - - function onFocus() { - setIsInserterShown(true); - } - - function onBlur() { - setIsInserterShown(false); - } // Position above the anchor, pop out towards the right, and position in the - // left corner. For the side inserter, pop out towards the left, and - // position in the right corner. - // To do: refactor `Popover` to make this prop clearer. - - - const popoverPosition = showEmptyBlockSideInserter ? 'top left right' : 'top right left'; - const { - ownerDocument - } = node; - const stickyBoundaryElement = showEmptyBlockSideInserter ? undefined : // The sticky boundary element should be the boundary at which the - // the block toolbar becomes sticky when the block scolls out of view. - // In case of an iframe, this should be the iframe boundary, otherwise - // the scroll container. - ownerDocument.defaultView.frameElement || Object(external_wp_dom_["getScrollContainer"])(node) || ownerDocument.body; - return Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], { - ref: popoverScrollRef, - noArrow: true, - animate: false, - position: popoverPosition, - focusOnMount: false, - anchorRef: anchorRef, - className: classnames_default()('block-editor-block-list__block-popover', { - 'is-insertion-point-visible': isInsertionPointVisible - }), - __unstableStickyBoundaryElement: stickyBoundaryElement // Render in the old slot if needed for backward compatibility, - // otherwise render in place (not in the the default popover slot). - , - __unstableSlotName: __unstablePopoverSlot || null, - __unstableBoundaryParent: true // Observe movement for block animations (especially horizontal). - , - __unstableObserveElement: node, - shouldAnchorIncludePadding: true - }, (shouldShowContextualToolbar || isToolbarForced) && Object(external_wp_element_["createElement"])("div", { - onFocus: onFocus, - onBlur: onBlur // 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()('block-editor-block-list__block-popover-inserter', { - 'is-visible': isInserterShown - }) - }, Object(external_wp_element_["createElement"])(inserter, { - clientId: clientId, - rootClientId: rootClientId, - __experimentalIsQuick: true - })), (shouldShowContextualToolbar || isToolbarForced) && Object(external_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: isToolbarForced, - __experimentalInitialIndex: initialToolbarItemIndexRef.current, - __experimentalOnIndexChange: index => { - initialToolbarItemIndexRef.current = index; - } // Resets the index whenever the active block changes so - // this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169 - , - key: clientId - }), shouldShowBreadcrumb && Object(external_wp_element_["createElement"])(block_selection_button, { - clientId: clientId, - rootClientId: rootClientId, - blockElement: node - }), showEmptyBlockSideInserter && Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-list__empty-block-inserter" - }, Object(external_wp_element_["createElement"])(inserter, { - position: "bottom right", - rootClientId: rootClientId, - clientId: clientId, - __experimentalIsQuick: true - }))); -} - -function wrapperSelector(select) { - const { - getSelectedBlockClientId, - getFirstMultiSelectedBlockClientId, - getBlockRootClientId, - __unstableGetBlockWithoutInnerBlocks, - getBlockParents, - __experimentalGetBlockListSettingsForBlocks - } = select(store); - const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId(); - - if (!clientId) { - return; - } - - const { - name, - attributes = {}, - isValid - } = __unstableGetBlockWithoutInnerBlocks(clientId) || {}; - const blockParentsClientIds = getBlockParents(clientId); // Get Block List Settings for all ancestors of the current Block clientId - - const parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(blockParentsClientIds); // Get the clientId of the topmost parent with the capture toolbars setting. - - - const capturingClientId = Object(external_lodash_["find"])(blockParentsClientIds, parentClientId => { - var _parentBlockListSetti; - - return (_parentBlockListSetti = parentBlockListSettings[parentClientId]) === null || _parentBlockListSetti === void 0 ? void 0 : _parentBlockListSetti.__experimentalCaptureToolbars; - }); - return { - clientId, - rootClientId: getBlockRootClientId(clientId), - name, - isValid, - isEmptyDefaultBlock: name && Object(external_wp_blocks_["isUnmodifiedDefaultBlock"])({ - name, - attributes - }), - capturingClientId - }; -} - -function WrappedBlockPopover({ - __unstablePopoverSlot, - __unstableContentRef -}) { - const selected = Object(external_wp_data_["useSelect"])(wrapperSelector, []); - - if (!selected) { - return null; - } - - const { - clientId, - rootClientId, - name, - isValid, - isEmptyDefaultBlock, - capturingClientId - } = selected; - - if (!name) { - return null; - } - - return Object(external_wp_element_["createElement"])(BlockPopover, { - clientId: clientId, - rootClientId: rootClientId, - isValid: isValid, - isEmptyDefaultBlock: isEmptyDefaultBlock, - capturingClientId: capturingClientId, - __unstablePopoverSlot: __unstablePopoverSlot, - __unstableContentRef: __unstableContentRef - }); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/back-compat.js - - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - -function BlockToolsBackCompat({ - children -}) { - const openRef = Object(external_wp_element_["useContext"])(InsertionPointOpenRef); - const isDisabled = Object(external_wp_element_["useContext"])(external_wp_components_["Disabled"].Context); // If context is set, `BlockTools` is a parent component. - - if (openRef || isDisabled) { - return children; - } - - external_wp_deprecated_default()('wp.components.Popover.Slot name="block-toolbar"', { - alternative: 'wp.blockEditor.BlockTools' - }); - return Object(external_wp_element_["createElement"])(InsertionPoint, { - __unstablePopoverSlot: "block-toolbar" - }, Object(external_wp_element_["createElement"])(WrappedBlockPopover, { - __unstablePopoverSlot: "block-toolbar" - }), children); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-selection-clearer/index.js + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Disabled, null, (0,external_wp_element_namespaceObject.createElement)(BlockList, null))); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-selection-clearer/index.js @@ -28233,11 +19490,11 @@ const { hasSelectedBlock, hasMultiSelection - } = Object(external_wp_data_["useSelect"])(store); + } = (0,external_wp_data_namespaceObject.useSelect)(store); const { clearSelectedBlock - } = Object(external_wp_data_["useDispatch"])(store); - return Object(external_wp_compose_["useRefEffect"])(node => { + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { function onMouseDown(event) { if (!hasSelectedBlock() && !hasMultiSelection()) { return; @@ -28258,8080 +19515,1474 @@ }, [hasSelectedBlock, hasMultiSelection, clearSelectedBlock]); } function BlockSelectionClearer(props) { - return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ + return (0,external_wp_element_namespaceObject.createElement)("div", _extends({ ref: useBlockSelectionClearer() }, props)); } -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/index.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - - - - - - - - -const IntersectionObserver = Object(external_wp_element_["createContext"])(); - -function Root({ - className, - children -}) { - const isLargeViewport = Object(external_wp_compose_["useViewportMatch"])('medium'); - const { - isOutlineMode, - isFocusMode, - isNavigationMode - } = Object(external_wp_data_["useSelect"])(select => { - const { - getSettings, - isNavigationMode: _isNavigationMode - } = select(store); - const { - outlineMode, - focusMode - } = getSettings(); - return { - isOutlineMode: outlineMode, - isFocusMode: focusMode, - isNavigationMode: _isNavigationMode() +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-multi-selection.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + +function selector(select) { + const { + isMultiSelecting, + getMultiSelectedBlockClientIds, + hasMultiSelection, + getSelectedBlockClientId, + getSelectedBlocksInitialCaretPosition, + __unstableIsFullySelected + } = select(store); + return { + isMultiSelecting: isMultiSelecting(), + multiSelectedBlockClientIds: getMultiSelectedBlockClientIds(), + hasMultiSelection: hasMultiSelection(), + selectedBlockClientId: getSelectedBlockClientId(), + initialPosition: getSelectedBlocksInitialCaretPosition(), + isFullSelection: __unstableIsFullySelected() + }; +} + +function useMultiSelection() { + const { + initialPosition, + isMultiSelecting, + multiSelectedBlockClientIds, + hasMultiSelection, + selectedBlockClientId, + isFullSelection + } = (0,external_wp_data_namespaceObject.useSelect)(selector, []); + const selectedRef = useBlockRef(selectedBlockClientId); // These must be in the right DOM order. + + const startRef = useBlockRef((0,external_lodash_namespaceObject.first)(multiSelectedBlockClientIds)); + const endRef = useBlockRef((0,external_lodash_namespaceObject.last)(multiSelectedBlockClientIds)); + /** + * When the component updates, and there is multi selection, we need to + * select the entire block contents. + */ + + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { + const { + ownerDocument + } = node; + const { + defaultView + } = ownerDocument; // Allow initialPosition to bypass focus behavior. This is useful + // for the list view or other areas where we don't want to transfer + // focus to the editor canvas. + + if (initialPosition === undefined || initialPosition === null) { + return; + } + + if (!hasMultiSelection || isMultiSelecting) { + if (!selectedBlockClientId || isMultiSelecting) { + return; + } + + const selection = defaultView.getSelection(); + + if (selection.rangeCount && !selection.isCollapsed) { + const blockNode = selectedRef.current; + const { + startContainer, + endContainer + } = selection.getRangeAt(0); + + if (!!blockNode && (!blockNode.contains(startContainer) || !blockNode.contains(endContainer))) { + selection.removeAllRanges(); + } + } + + return; + } + + const { + length + } = multiSelectedBlockClientIds; + + if (length < 2) { + return; + } + + if (!isFullSelection) { + return; + } // Allow cross contentEditable selection by temporarily making + // all content editable. We can't rely on using the store and + // React because re-rending happens too slowly. We need to be + // able to select across instances immediately. + + + node.contentEditable = true; // For some browsers, like Safari, it is important that focus happens + // BEFORE selection. + + node.focus(); // The block refs might not be immediately available + // when dragging blocks into another block. + + if (!startRef.current || !endRef.current) { + return; + } + + const selection = defaultView.getSelection(); + const range = ownerDocument.createRange(); // These must be in the right DOM order. + + range.setStartBefore(startRef.current); + range.setEndAfter(endRef.current); + selection.removeAllRanges(); + selection.addRange(range); + }, [hasMultiSelection, isMultiSelecting, multiSelectedBlockClientIds, selectedBlockClientId, initialPosition, isFullSelection]); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-tab-nav.js + + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + +function useTabNav() { + const container = (0,external_wp_element_namespaceObject.useRef)(); + const focusCaptureBeforeRef = (0,external_wp_element_namespaceObject.useRef)(); + const focusCaptureAfterRef = (0,external_wp_element_namespaceObject.useRef)(); + const lastFocus = (0,external_wp_element_namespaceObject.useRef)(); + const { + hasMultiSelection, + getSelectedBlockClientId, + getBlockCount + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const { + setNavigationMode + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const isNavigationMode = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isNavigationMode(), []); // Don't allow tabbing to this element in Navigation mode. + + const focusCaptureTabIndex = !isNavigationMode ? '0' : undefined; // Reference that holds the a flag for enabling or disabling + // capturing on the focus capture elements. + + const noCapture = (0,external_wp_element_namespaceObject.useRef)(); + + function onFocusCapture(event) { + // Do not capture incoming focus if set by us in WritingFlow. + if (noCapture.current) { + noCapture.current = null; + } else if (hasMultiSelection()) { + container.current.focus(); + } else if (getSelectedBlockClientId()) { + lastFocus.current.focus(); + } else { + setNavigationMode(true); + const isBefore = // eslint-disable-next-line no-bitwise + event.target.compareDocumentPosition(container.current) & event.target.DOCUMENT_POSITION_FOLLOWING; + const action = isBefore ? 'findNext' : 'findPrevious'; + external_wp_dom_namespaceObject.focus.tabbable[action](event.target).focus(); + } + } + + const before = (0,external_wp_element_namespaceObject.createElement)("div", { + ref: focusCaptureBeforeRef, + tabIndex: focusCaptureTabIndex, + onFocus: onFocusCapture + }); + const after = (0,external_wp_element_namespaceObject.createElement)("div", { + ref: focusCaptureAfterRef, + tabIndex: focusCaptureTabIndex, + onFocus: onFocusCapture + }); + const ref = (0,external_wp_compose_namespaceObject.useRefEffect)(node => { + function onKeyDown(event) { + if (event.defaultPrevented) { + return; + } + + if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !hasMultiSelection()) { + event.preventDefault(); + setNavigationMode(true); + return; + } // In Edit mode, Tab should focus the first tabbable element after + // the content, which is normally the sidebar (with block controls) + // and Shift+Tab should focus the first tabbable element before the + // content, which is normally the block toolbar. + // Arrow keys can be used, and Tab and arrow keys can be used in + // Navigation mode (press Esc), to navigate through blocks. + + + if (event.keyCode !== external_wp_keycodes_namespaceObject.TAB) { + return; + } + + const isShift = event.shiftKey; + const direction = isShift ? 'findPrevious' : 'findNext'; + + if (!hasMultiSelection() && !getSelectedBlockClientId()) { + // Preserve the behaviour of entering navigation mode when + // tabbing into the content without a block selection. + // `onFocusCapture` already did this previously, but we need to + // do it again here because after clearing block selection, + // focus land on the writing flow container and pressing Tab + // will no longer send focus through the focus capture element. + if (event.target === node) setNavigationMode(true); + return; + } // Allow tabbing from the block wrapper to a form element, + // and between form elements rendered in a block, + // such as inside a placeholder. Form elements are generally + // meant to be UI rather than part of the content. Ideally + // these are not rendered in the content and perhaps in the + // future they can be rendered in an iframe or shadow DOM. + + + if (((0,external_wp_dom_namespaceObject.isFormElement)(event.target) || event.target.getAttribute('data-block') === getSelectedBlockClientId()) && (0,external_wp_dom_namespaceObject.isFormElement)(external_wp_dom_namespaceObject.focus.tabbable[direction](event.target))) { + return; + } + + const next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef; // Disable focus capturing on the focus capture element, so it + // doesn't refocus this block and so it allows default behaviour + // (moving focus to the next tabbable element). + + noCapture.current = true; // Focusing the focus capture element, which is located above and + // below the editor, should not scroll the page all the way up or + // down. + + next.current.focus({ + preventScroll: true + }); + } + + function onFocusOut(event) { + lastFocus.current = event.target; + const { + ownerDocument + } = node; // If focus disappears due to there being no blocks, move focus to + // the writing flow wrapper. + + if (!event.relatedTarget && ownerDocument.activeElement === ownerDocument.body && getBlockCount() === 0) { + node.focus(); + } + } // When tabbing back to an element in block list, this event handler prevents scrolling if the + // focus capture divs (before/after) are outside of the viewport. (For example shift+tab back to a paragraph + // when focus is on a sidebar element. This prevents the scrollable writing area from jumping either to the + // top or bottom of the document. + // + // Note that it isn't possible to disable scrolling in the onFocus event. We need to intercept this + // earlier in the keypress handler, and call focus( { preventScroll: true } ) instead. + // https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus#parameters + + + function preventScrollOnTab(event) { + var _event$target; + + if (event.keyCode !== external_wp_keycodes_namespaceObject.TAB) { + return; + } + + if (((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.getAttribute('role')) === 'region') { + return; + } + + if (container.current === event.target) { + return; + } + + const isShift = event.shiftKey; + const direction = isShift ? 'findPrevious' : 'findNext'; + const target = external_wp_dom_namespaceObject.focus.tabbable[direction](event.target); // Only do something when the next tabbable is a focus capture div (before/after) + + if (target === focusCaptureBeforeRef.current || target === focusCaptureAfterRef.current) { + event.preventDefault(); + target.focus({ + preventScroll: true + }); + } + } + + const { + ownerDocument + } = node; + const { + defaultView + } = ownerDocument; + defaultView.addEventListener('keydown', preventScrollOnTab); + node.addEventListener('keydown', onKeyDown); + node.addEventListener('focusout', onFocusOut); + return () => { + defaultView.removeEventListener('keydown', preventScrollOnTab); + node.removeEventListener('keydown', onKeyDown); + node.removeEventListener('focusout', onFocusOut); + }; + }, []); + const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([container, ref]); + return [before, mergedRefs, after]; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-arrow-nav.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + +/** + * 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) { + const isVertical = keyCode === external_wp_keycodes_namespaceObject.UP || keyCode === external_wp_keycodes_namespaceObject.DOWN; // Currently, all elements support unmodified vertical navigation. + + if (isVertical && !hasModifier) { + return true; + } // Native inputs should not navigate horizontally. + + + const { + tagName + } = element; + return tagName !== 'INPUT' && tagName !== 'TEXTAREA'; +} +/** + * 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. + * @param {Element} containerElement Element containing all blocks. + * @param {boolean} onlyVertical Whether to only consider tabbable elements + * that are visually above or under the + * target. + * + * @return {?Element} Optimal tab target, if one exists. + */ + +function getClosestTabbable(target, isReverse, containerElement, onlyVertical) { + // Since the current focus target is not guaranteed to be a text field, find + // all focusables. Tabbability is considered later. + let focusableNodes = external_wp_dom_namespaceObject.focus.focusable.find(containerElement); + + if (isReverse) { + focusableNodes = (0,external_lodash_namespaceObject.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); + let targetRect; + + if (onlyVertical) { + targetRect = target.getBoundingClientRect(); + } + + function isTabCandidate(node) { + // Not a candidate if the node is not tabbable. + if (!external_wp_dom_namespaceObject.focus.tabbable.isTabbableIndex(node)) { + return false; + } // Skip focusable elements such as links within content editable nodes. + + + if (node.isContentEditable && node.contentEditable !== 'true') { + return false; + } + + if (onlyVertical) { + const nodeRect = node.getBoundingClientRect(); + + if (nodeRect.left >= targetRect.right || nodeRect.right <= targetRect.left) { + return false; + } + } + + return true; + } + + return (0,external_lodash_namespaceObject.find)(focusableNodes, isTabCandidate); +} +function useArrowNav() { + const { + getSelectedBlockClientId, + getMultiSelectedBlocksEndClientId, + getPreviousBlockClientId, + getNextBlockClientId, + getSettings, + hasMultiSelection + } = (0,external_wp_data_namespaceObject.useSelect)(store); + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { + // Here a DOMRect 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. + let verticalRect; + + function onMouseDown() { + verticalRect = null; + } + /** + * 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. + */ + + + function isTabbableEdge(target, isReverse) { + const closestTabbable = getClosestTabbable(target, isReverse, node); + return !closestTabbable || !isInSameBlock(target, closestTabbable); + } + + function onKeyDown(event) { + const { + keyCode, + target + } = event; + const isUp = keyCode === external_wp_keycodes_namespaceObject.UP; + const isDown = keyCode === external_wp_keycodes_namespaceObject.DOWN; + const isLeft = keyCode === external_wp_keycodes_namespaceObject.LEFT; + const isRight = keyCode === external_wp_keycodes_namespaceObject.RIGHT; + const isReverse = isUp || isLeft; + const isHorizontal = isLeft || isRight; + const isVertical = isUp || isDown; + const isNav = isHorizontal || isVertical; + const isShift = event.shiftKey; + const hasModifier = isShift || event.ctrlKey || event.altKey || event.metaKey; + const isNavEdge = isVertical ? external_wp_dom_namespaceObject.isVerticalEdge : external_wp_dom_namespaceObject.isHorizontalEdge; + const { + ownerDocument + } = node; + const { + defaultView + } = ownerDocument; + + if (hasMultiSelection()) { + return; + } // When presing any key other than up or down, the initial vertical + // position must ALWAYS be reset. The vertical position is saved so + // it can be restored as well as possible on sebsequent vertical + // arrow key presses. It may not always be possible to restore the + // exact same position (such as at an empty line), so it wouldn't be + // good to compute the position right before any vertical arrow key + // press. + + + if (!isVertical) { + verticalRect = null; + } else if (!verticalRect) { + verticalRect = (0,external_wp_dom_namespaceObject.computeCaretRect)(defaultView); + } // Abort if navigation has already been handled (e.g. RichText + // inline boundaries). + + + if (event.defaultPrevented) { + return; + } + + if (!isNav) { + return; + } // Abort if our current target is not a candidate for navigation + // (e.g. preserve native input behaviors). + + + if (!isNavigationCandidate(target, keyCode, hasModifier)) { + return; + } // In the case of RTL scripts, right means previous and left means + // next, which is the exact reverse of LTR. + + + const isReverseDir = (0,external_wp_dom_namespaceObject.isRTL)(target) ? !isReverse : isReverse; + const { + keepCaretInsideBlock + } = getSettings(); + const selectedBlockClientId = getSelectedBlockClientId(); + + if (isShift) { + const selectionEndClientId = getMultiSelectedBlocksEndClientId(); + const selectionBeforeEndClientId = getPreviousBlockClientId(selectionEndClientId || selectedBlockClientId); + const selectionAfterEndClientId = getNextBlockClientId(selectionEndClientId || selectedBlockClientId); + + if ( // Ensure that there is a target block. + (isReverse && selectionBeforeEndClientId || !isReverse && selectionAfterEndClientId) && isTabbableEdge(target, isReverse) && isNavEdge(target, isReverse)) { + node.contentEditable = true; // Firefox doesn't automatically move focus. + + node.focus(); + } + } else if (isVertical && (0,external_wp_dom_namespaceObject.isVerticalEdge)(target, isReverse) && !keepCaretInsideBlock) { + const closestTabbable = getClosestTabbable(target, isReverse, node, true); + + if (closestTabbable) { + (0,external_wp_dom_namespaceObject.placeCaretAtVerticalEdge)(closestTabbable, isReverse, verticalRect); + event.preventDefault(); + } + } else if (isHorizontal && defaultView.getSelection().isCollapsed && (0,external_wp_dom_namespaceObject.isHorizontalEdge)(target, isReverseDir) && !keepCaretInsideBlock) { + const closestTabbable = getClosestTabbable(target, isReverseDir, node); + (0,external_wp_dom_namespaceObject.placeCaretAtHorizontalEdge)(closestTabbable, isReverse); + event.preventDefault(); + } + } + + node.addEventListener('mousedown', onMouseDown); + node.addEventListener('keydown', onKeyDown); + return () => { + node.removeEventListener('mousedown', onMouseDown); + node.removeEventListener('keydown', onKeyDown); }; }, []); - return Object(external_wp_element_["createElement"])(Head, null, Object(external_wp_element_["createElement"])("div", { - ref: Object(external_wp_compose_["useMergeRefs"])([useBlockSelectionClearer(), useBlockDropZone(), useInBetweenInserter()]), - className: classnames_default()('block-editor-block-list__layout is-root-container', className, { - 'is-outline-mode': isOutlineMode, - 'is-focus-mode': isFocusMode && isLargeViewport, - 'is-navigate-mode': isNavigationMode - }) - }, children)); -} - -function BlockList({ - className, - ...props -}) { - usePreParsePatterns(); - return Object(external_wp_element_["createElement"])(BlockToolsBackCompat, null, Object(external_wp_element_["createElement"])(Root, { - className: className - }, Object(external_wp_element_["createElement"])(BlockListItems, props))); -} - -function Items({ - placeholder, - rootClientId, - renderAppender, - __experimentalAppenderTagName, - __experimentalLayout: layout = layout_defaultLayout -}) { - const [intersectingBlocks, setIntersectingBlocks] = Object(external_wp_element_["useState"])(new Set()); - const intersectionObserver = Object(external_wp_element_["useMemo"])(() => { - const { - IntersectionObserver: Observer - } = window; - - if (!Observer) { - return; - } - - return new Observer(entries => { - setIntersectingBlocks(oldIntersectingBlocks => { - const newIntersectingBlocks = new Set(oldIntersectingBlocks); - - for (const entry of entries) { - const clientId = entry.target.getAttribute('data-block'); - const action = entry.isIntersecting ? 'add' : 'delete'; - newIntersectingBlocks[action](clientId); - } - - return newIntersectingBlocks; - }); - }); - }, [setIntersectingBlocks]); - const { - order, - selectedBlocks - } = Object(external_wp_data_["useSelect"])(select => { - const { - getBlockOrder, - getSelectedBlockClientIds - } = select(store); - return { - order: getBlockOrder(rootClientId), - selectedBlocks: getSelectedBlockClientIds() - }; - }, [rootClientId]); - return Object(external_wp_element_["createElement"])(LayoutProvider, { - value: layout - }, Object(external_wp_element_["createElement"])(IntersectionObserver.Provider, { - value: intersectionObserver - }, order.map(clientId => Object(external_wp_element_["createElement"])(external_wp_data_["AsyncModeProvider"], { - key: clientId, - value: // Only provide data asynchronously if the block is - // not visible and not selected. - !intersectingBlocks.has(clientId) && !selectedBlocks.includes(clientId) - }, Object(external_wp_element_["createElement"])(block_list_block, { - rootClientId: rootClientId, - clientId: clientId - })))), order.length < 1 && placeholder, Object(external_wp_element_["createElement"])(block_list_appender, { - tagName: __experimentalAppenderTagName, - rootClientId: rootClientId, - renderAppender: renderAppender - })); -} - -function BlockListItems(props) { - // This component needs to always be synchronous as it's the one changing - // the async mode depending on the block selection. - return Object(external_wp_element_["createElement"])(external_wp_data_["AsyncModeProvider"], { - value: false - }, Object(external_wp_element_["createElement"])(Items, props)); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-intersection-observer.js -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -function useIntersectionObserver() { - const observer = Object(external_wp_element_["useContext"])(IntersectionObserver); - return Object(external_wp_compose_["useRefEffect"])(node => { - if (observer) { - observer.observe(node); - return () => { - observer.unobserve(node); - }; - } - }, [observer]); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/index.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - - - - - - - - - - - - - - - -/** - * If the block count exceeds the threshold, we disable the reordering animation - * to avoid laginess. - */ - -const BLOCK_ANIMATION_THRESHOLD = 200; -/** - * This hook is used to lightly mark an element as a block element. The element - * should be the outermost element of a block. Call this hook and pass the - * returned props to the element to mark as a block. If you define a ref for the - * element, it is important to pass the ref to this hook, which the hook in turn - * will pass to the component through the props it returns. Optionally, you can - * also pass any other props through this hook, and they will be merged and - * returned. - * - * @param {Object} props Optional. Props to pass to the element. Must contain - * the ref if one is defined. - * @param {Object} options Options for internal use only. - * @param {boolean} options.__unstableIsHtml - * - * @return {Object} Props to pass to the element to mark as a block. - */ - -function useBlockProps(props = {}, { - __unstableIsHtml -} = {}) { - const { - clientId, - className, - wrapperProps = {}, - isAligned - } = Object(external_wp_element_["useContext"])(BlockListBlockContext); - const { - index, - mode, - name, - blockTitle, - isPartOfSelection, - adjustScrolling, - enableAnimation - } = Object(external_wp_data_["useSelect"])(select => { - const { - getBlockRootClientId, - getBlockIndex, - getBlockMode, - getBlockName, - isTyping, - getGlobalBlockCount, - isBlockSelected, - isBlockMultiSelected, - isAncestorMultiSelected, - isFirstMultiSelectedBlock - } = select(store); - const isSelected = isBlockSelected(clientId); - const isPartOfMultiSelection = isBlockMultiSelected(clientId) || isAncestorMultiSelected(clientId); - const blockName = getBlockName(clientId); - const rootClientId = getBlockRootClientId(clientId); - return { - index: getBlockIndex(clientId, rootClientId), - mode: getBlockMode(clientId), - name: blockName, - blockTitle: Object(external_wp_blocks_["getBlockType"])(blockName).title, - isPartOfSelection: isSelected || isPartOfMultiSelection, - adjustScrolling: isSelected || isFirstMultiSelectedBlock(clientId), - enableAnimation: !isTyping() && getGlobalBlockCount() <= BLOCK_ANIMATION_THRESHOLD - }; - }, [clientId]); // translators: %s: Type of block (i.e. Text, Image etc) - - const blockLabel = Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('Block: %s'), blockTitle); - const htmlSuffix = mode === 'html' && !__unstableIsHtml ? '-visual' : ''; - const mergedRefs = Object(external_wp_compose_["useMergeRefs"])([props.ref, useFocusFirstElement(clientId), // Must happen after focus because we check for focus in the block. - useScrollIntoView(clientId), useBlockRefProvider(clientId), useFocusHandler(clientId), useMultiSelection(clientId), useEventHandlers(clientId), useNavModeExit(clientId), useIsHovered(), useIntersectionObserver(), use_moving_animation({ - isSelected: isPartOfSelection, - adjustScrolling, - enableAnimation, - triggerAnimationOnChange: index - })]); - return { ...wrapperProps, - ...props, - ref: mergedRefs, - id: `block-${clientId}${htmlSuffix}`, - tabIndex: 0, - role: 'group', - 'aria-label': blockLabel, - 'data-block': clientId, - 'data-type': name, - 'data-title': blockTitle, - className: classnames_default()( // The wp-block className is important for editor styles. - classnames_default()('block-editor-block-list__block', { - 'wp-block': !isAligned - }), className, props.className, wrapperProps.className, useBlockClassNames(clientId), useBlockDefaultClassName(clientId), useBlockCustomClassName(clientId), useBlockMovingModeClassNames(clientId)), - style: { ...wrapperProps.style, - ...props.style - } - }; -} -/** - * Call within a save function to get the props for the block wrapper. - * - * @param {Object} props Optional. Props to pass to the element. - */ - -useBlockProps.save = external_wp_blocks_["__unstableGetBlockProps"]; - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block.js - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - - - - -/** - * Internal dependencies - */ - - - - - - - - -const BlockListBlockContext = Object(external_wp_element_["createContext"])(); -/** - * Merges wrapper props with special handling for classNames and styles. - * - * @param {Object} propsA - * @param {Object} propsB - * - * @return {Object} Merged props. - */ - -function mergeWrapperProps(propsA, propsB) { - const newProps = { ...propsA, - ...propsB - }; - - if (propsA && propsB && propsA.className && propsB.className) { - newProps.className = classnames_default()(propsA.className, propsB.className); - } - - if (propsA && propsB && propsA.style && propsB.style) { - newProps.style = { ...propsA.style, - ...propsB.style - }; - } - - return newProps; -} - -function Block({ - children, - isHtml, - ...props -}) { - return Object(external_wp_element_["createElement"])("div", useBlockProps(props, { - __unstableIsHtml: isHtml - }), children); -} - -function block_BlockListBlock({ - mode, - isLocked, - clientId, - isSelected, - isSelectionEnabled, - className, - name, - isValid, - attributes, - wrapperProps, - setAttributes, - onReplace, - onInsertBlocksAfter, - onMerge, - toggleSelection -}) { - const { - removeBlock - } = Object(external_wp_data_["useDispatch"])(store); - const onRemove = Object(external_wp_element_["useCallback"])(() => removeBlock(clientId), [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. - - let blockEdit = Object(external_wp_element_["createElement"])(block_edit_BlockEdit, { - name: name, - isSelected: isSelected, - attributes: attributes, - setAttributes: setAttributes, - insertBlocksAfter: isLocked ? undefined : onInsertBlocksAfter, - onReplace: isLocked ? undefined : onReplace, - onRemove: isLocked ? undefined : onRemove, - mergeBlocks: isLocked ? undefined : onMerge, - clientId: clientId, - isSelectionEnabled: isSelectionEnabled, - toggleSelection: toggleSelection - }); - const blockType = Object(external_wp_blocks_["getBlockType"])(name); - const lightBlockWrapper = blockType.apiVersion > 1 || Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'lightBlockWrapper', false); // Determine whether the block has props to apply to the wrapper. - - if (blockType.getEditWrapperProps) { - wrapperProps = mergeWrapperProps(wrapperProps, blockType.getEditWrapperProps(attributes)); - } - - const isAligned = wrapperProps && !!wrapperProps['data-align']; // For aligned blocks, provide a wrapper element so the block can be - // positioned relative to the block column. - - if (isAligned) { - blockEdit = Object(external_wp_element_["createElement"])("div", { - className: "wp-block", - "data-align": wrapperProps['data-align'] - }, blockEdit); - } - - let block; - - if (!isValid) { - const saveContent = Object(external_wp_blocks_["getSaveContent"])(blockType, attributes); - block = Object(external_wp_element_["createElement"])(Block, { - className: "has-warning" - }, Object(external_wp_element_["createElement"])(block_invalid_warning, { - clientId: clientId - }), Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, Object(external_wp_dom_["safeHTML"])(saveContent))); - } else if (mode === 'html') { - // Render blockEdit so the inspector controls don't disappear. - // See #8969. - block = Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { - style: { - display: 'none' - } - }, blockEdit), Object(external_wp_element_["createElement"])(Block, { - isHtml: true - }, Object(external_wp_element_["createElement"])(block_html, { - clientId: clientId - }))); - } else if (lightBlockWrapper) { - block = blockEdit; - } else { - block = Object(external_wp_element_["createElement"])(Block, wrapperProps, blockEdit); - } - - const value = { - clientId, - className, - wrapperProps: Object(external_lodash_["omit"])(wrapperProps, ['data-align']), - isAligned - }; - const memoizedValue = Object(external_wp_element_["useMemo"])(() => value, Object.values(value)); - return Object(external_wp_element_["createElement"])(BlockListBlockContext.Provider, { - value: memoizedValue - }, Object(external_wp_element_["createElement"])(block_crash_boundary, { - fallback: Object(external_wp_element_["createElement"])(Block, { - className: "has-warning" - }, Object(external_wp_element_["createElement"])(block_crash_warning, null)) - }, block)); -} - -const applyWithSelect = Object(external_wp_data_["withSelect"])((select, { - clientId, - rootClientId -}) => { - const { - isBlockSelected, - getBlockMode, +} + +;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"] +var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-select-all.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + +function useSelectAll() { + const { + getBlockOrder, + getSelectedBlockClientIds, + getBlockRootClientId + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const { + multiSelect + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)(); + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { + function onKeyDown(event) { + if (!isMatch('core/block-editor/select-all', event)) { + return; + } + + const selectedClientIds = getSelectedBlockClientIds(); + + if (selectedClientIds.length < 2 && !(0,external_wp_dom_namespaceObject.isEntirelySelected)(event.target)) { + return; + } + + const [firstSelectedClientId] = selectedClientIds; + const rootClientId = getBlockRootClientId(firstSelectedClientId); + let blockClientIds = getBlockOrder(rootClientId); // If we have selected all sibling nested blocks, try selecting up a + // level. See: https://github.com/WordPress/gutenberg/pull/31859/ + + if (selectedClientIds.length === blockClientIds.length) { + blockClientIds = getBlockOrder(getBlockRootClientId(rootClientId)); + } + + const firstClientId = (0,external_lodash_namespaceObject.first)(blockClientIds); + const lastClientId = (0,external_lodash_namespaceObject.last)(blockClientIds); + + if (firstClientId === lastClientId) { + return; + } + + multiSelect(firstClientId, lastClientId); + event.preventDefault(); + } + + node.addEventListener('keydown', onKeyDown); + return () => { + node.removeEventListener('keydown', onKeyDown); + }; + }, []); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-drag-selection.js +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +/** + * Sets the `contenteditable` wrapper element to `value`. + * + * @param {HTMLElement} node Block element. + * @param {boolean} value `contentEditable` value (true or false) + */ + +function setContentEditableWrapper(node, value) { + node.contentEditable = value; // Firefox doesn't automatically move focus. + + if (value) node.focus(); +} +/** + * Sets a multi-selection based on the native selection across blocks. + */ + + +function useDragSelection() { + const { + startMultiSelect, + stopMultiSelect + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const { isSelectionEnabled, - getTemplateLock, - __unstableGetBlockWithoutInnerBlocks - } = select(store); - - const block = __unstableGetBlockWithoutInnerBlocks(clientId); - - const isSelected = isBlockSelected(clientId); - const templateLock = getTemplateLock(rootClientId); // 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. - - const { - name, - attributes, - isValid - } = block || {}; // Do not add new properties here, use `useSelect` instead to avoid - // leaking new props to the public API (editor.BlockListBlock filter). - - return { - mode: getBlockMode(clientId), - isSelectionEnabled: isSelectionEnabled(), - isLocked: !!templateLock, - // 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, - name, - attributes, - isValid, - isSelected - }; -}); -const applyWithDispatch = Object(external_wp_data_["withDispatch"])((dispatch, ownProps, { - select -}) => { - const { - updateBlockAttributes, - insertBlocks, - mergeBlocks, - replaceBlocks, - toggleSelection, - __unstableMarkLastChangeAsPersistent - } = dispatch(store); // Do not add new properties here, use `useDispatch` instead to avoid - // leaking new props to the public API (editor.BlockListBlock filter). - - return { - setAttributes(newAttributes) { - const { - getMultiSelectedBlockClientIds - } = select(store); - const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(); - const { - clientId - } = ownProps; - const clientIds = multiSelectedBlockClientIds.length ? multiSelectedBlockClientIds : [clientId]; - updateBlockAttributes(clientIds, newAttributes); - }, - - onInsertBlocks(blocks, index) { - const { - rootClientId - } = ownProps; - insertBlocks(blocks, index, rootClientId); - }, - - onInsertBlocksAfter(blocks) { - const { - clientId, - rootClientId - } = ownProps; - const { - getBlockIndex - } = select(store); - const index = getBlockIndex(clientId, rootClientId); - insertBlocks(blocks, index + 1, rootClientId); - }, - - onMerge(forward) { - const { - clientId - } = ownProps; - const { - getPreviousBlockClientId, - getNextBlockClientId - } = select(store); - - if (forward) { - const nextBlockClientId = getNextBlockClientId(clientId); - - if (nextBlockClientId) { - mergeBlocks(clientId, nextBlockClientId); - } + hasMultiSelection + } = (0,external_wp_data_namespaceObject.useSelect)(store); + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { + const { + ownerDocument + } = node; + const { + defaultView + } = ownerDocument; + let anchorElement; + let rafId; + + function onMouseUp() { + stopMultiSelect(); // Equivalent to attaching the listener once. + + defaultView.removeEventListener('mouseup', onMouseUp); // The browser selection won't have updated yet at this point, + // so wait until the next animation frame to get the browser + // selection. + + rafId = defaultView.requestAnimationFrame(() => { + if (hasMultiSelection()) { + return; + } // If the selection is complete (on mouse up), and no + // multiple blocks have been selected, set focus back to the + // anchor element. if the anchor element contains the + // selection. Additionally, the contentEditable wrapper can + // now be disabled again. + + + setContentEditableWrapper(node, false); + const selection = defaultView.getSelection(); + + if (selection.rangeCount) { + const { + commonAncestorContainer + } = selection.getRangeAt(0); + + if (anchorElement.contains(commonAncestorContainer)) { + anchorElement.focus(); + } + } + }); + } + + function onMouseLeave(_ref) { + let { + buttons, + target + } = _ref; + + // The primary button must be pressed to initiate selection. + // See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons + if (buttons !== 1) { + return; + } // Check the attribute, not the contentEditable attribute. All + // child elements of the content editable wrapper are editable + // and return true for this property. We only want to start + // multi selecting when the mouse leaves the wrapper. + + + if (!target.getAttribute('contenteditable')) { + return; + } + + if (!isSelectionEnabled()) { + return; + } + + anchorElement = ownerDocument.activeElement; + startMultiSelect(); // `onSelectionStart` is called after `mousedown` and + // `mouseleave` (from a block). The selection ends when + // `mouseup` happens anywhere in the window. + + defaultView.addEventListener('mouseup', onMouseUp); // Allow cross contentEditable selection by temporarily making + // all content editable. We can't rely on using the store and + // React because re-rending happens too slowly. We need to be + // able to select across instances immediately. + + setContentEditableWrapper(node, true); + } + + node.addEventListener('mouseout', onMouseLeave); + return () => { + node.removeEventListener('mouseout', onMouseLeave); + defaultView.removeEventListener('mouseup', onMouseUp); + defaultView.cancelAnimationFrame(rafId); + }; + }, [startMultiSelect, stopMultiSelect, isSelectionEnabled, hasMultiSelection]); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-selection-observer.js +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + +/** + * Extract the selection start node from the selection. When the anchor node is + * not a text node, the selection offset is the index of a child node. + * + * @param {Selection} selection The selection. + * + * @return {Element} The selection start node. + */ + +function extractSelectionStartNode(selection) { + const { + anchorNode, + anchorOffset + } = selection; + + if (anchorNode.nodeType === anchorNode.TEXT_NODE) { + return anchorNode; + } + + return anchorNode.childNodes[anchorOffset]; +} +/** + * Extract the selection end node from the selection. When the focus node is not + * a text node, the selection offset is the index of a child node. The selection + * reaches up to but excluding that child node. + * + * @param {Selection} selection The selection. + * + * @return {Element} The selection start node. + */ + + +function extractSelectionEndNode(selection) { + const { + focusNode, + focusOffset + } = selection; + + if (focusNode.nodeType === focusNode.TEXT_NODE) { + return focusNode; + } + + return focusNode.childNodes[focusOffset - 1]; +} + +function findDepth(a, b) { + let depth = 0; + + while (a[depth] === b[depth]) { + depth++; + } + + return depth; +} +/** + * Sets the `contenteditable` wrapper element to `value`. + * + * @param {HTMLElement} node Block element. + * @param {boolean} value `contentEditable` value (true or false) + */ + + +function use_selection_observer_setContentEditableWrapper(node, value) { + node.contentEditable = value; // Firefox doesn't automatically move focus. + + if (value) node.focus(); +} +/** + * Sets a multi-selection based on the native selection across blocks. + */ + + +function useSelectionObserver() { + const { + multiSelect, + selectBlock, + selectionChange + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const { + getBlockParents, + getBlockSelectionStart + } = (0,external_wp_data_namespaceObject.useSelect)(store); + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { + const { + ownerDocument + } = node; + const { + defaultView + } = ownerDocument; + + function onSelectionChange(event) { + const selection = defaultView.getSelection(); // If no selection is found, end multi selection and disable the + // contentEditable wrapper. + + if (!selection.rangeCount) { + use_selection_observer_setContentEditableWrapper(node, false); + return; + } // If selection is collapsed and we haven't used `shift+click`, + // end multi selection and disable the contentEditable wrapper. + // We have to check about `shift+click` case because elements + // that don't support text selection might be involved, and we might + // update the clientIds to multi-select blocks. + // For now we check if the event is a `mouse` event. + + + const isClickShift = event.shiftKey && event.type === 'mouseup'; + + if (selection.isCollapsed && !isClickShift) { + use_selection_observer_setContentEditableWrapper(node, false); + return; + } + + let startClientId = getBlockClientId(extractSelectionStartNode(selection)); + let endClientId = getBlockClientId(extractSelectionEndNode(selection)); // If the selection has changed and we had pressed `shift+click`, + // we need to check if in an element that doesn't support + // text selection has been clicked. + + if (isClickShift) { + const selectedClientId = getBlockSelectionStart(); + const clickedClientId = getBlockClientId(event.target); // `endClientId` is not defined if we end the selection by clicking a non-selectable block. + // We need to check if there was already a selection with a non-selectable focusNode. + + const focusNodeIsNonSelectable = clickedClientId !== endClientId; + + if (startClientId === endClientId && selection.isCollapsed || !endClientId || focusNodeIsNonSelectable) { + endClientId = clickedClientId; + } // Handle the case when we have a non-selectable block + // selected and click another one. + + + if (startClientId !== selectedClientId) { + startClientId = selectedClientId; + } + } // If the selection did not involve a block, return. + + + if (startClientId === undefined && endClientId === undefined) { + use_selection_observer_setContentEditableWrapper(node, false); + return; + } + + const isSingularSelection = startClientId === endClientId; + + if (isSingularSelection) { + selectBlock(startClientId); } else { - const previousBlockClientId = getPreviousBlockClientId(clientId); - - if (previousBlockClientId) { - mergeBlocks(previousBlockClientId, clientId); - } - } - }, - - onReplace(blocks, indexToSelect, initialPosition) { - if (blocks.length && !Object(external_wp_blocks_["isUnmodifiedDefaultBlock"])(blocks[blocks.length - 1])) { - __unstableMarkLastChangeAsPersistent(); - } - - replaceBlocks([ownProps.clientId], blocks, indexToSelect, initialPosition); - }, - - toggleSelection(selectionEnabled) { - toggleSelection(selectionEnabled); - } - - }; -}); -/* harmony default export */ var block_list_block = (Object(external_wp_compose_["compose"])(external_wp_compose_["pure"], applyWithSelect, applyWithDispatch, // block is sometimes not mounted at the right time, causing it be undefined -// see issue for more info -// https://github.com/WordPress/gutenberg/issues/17013 -Object(external_wp_compose_["ifCondition"])(({ - block -}) => !!block), Object(external_wp_components_["withFilters"])('editor.BlockListBlock'))(block_BlockListBlock)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/utils.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -const getBlockPositionDescription = (position, siblingCount, level) => Object(external_wp_i18n_["sprintf"])( -/* translators: 1: The numerical position of the block. 2: The total number of blocks. 3. The level of nesting for the block. */ -Object(external_wp_i18n_["__"])('Block %1$d of %2$d, Level %3$d'), position, siblingCount, level); -/** - * Returns true if the client ID occurs within the block selection or multi-selection, - * or false otherwise. - * - * @param {string} clientId Block client ID. - * @param {string|string[]} selectedBlockClientIds Selected block client ID, or an array of multi-selected blocks client IDs. - * - * @return {boolean} Whether the block is in multi-selection set. - */ - -const isClientIdSelected = (clientId, selectedBlockClientIds) => Object(external_lodash_["isArray"])(selectedBlockClientIds) && selectedBlockClientIds.length ? selectedBlockClientIds.indexOf(clientId) !== -1 : selectedBlockClientIds === clientId; - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/block-select-button.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - - - - -function BlockNavigationBlockSelectButton({ - className, - block: { - clientId - }, - isSelected, - onClick, - position, - siblingBlockCount, - level, - tabIndex, - onFocus, - onDragStart, - onDragEnd, - draggable -}, ref) { - const blockInformation = useBlockDisplayInformation(clientId); - const instanceId = Object(external_wp_compose_["useInstanceId"])(BlockNavigationBlockSelectButton); - const descriptionId = `block-navigation-block-select-button__${instanceId}`; - const blockPositionDescription = getBlockPositionDescription(position, siblingBlockCount, level); - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - className: classnames_default()('block-editor-block-navigation-block-select-button', className), - onClick: onClick, - "aria-describedby": descriptionId, - ref: ref, - tabIndex: tabIndex, - onFocus: onFocus, - onDragStart: onDragStart, - onDragEnd: onDragEnd, - draggable: draggable - }, Object(external_wp_element_["createElement"])(BlockIcon, { - icon: blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon, - showColors: true - }), Object(external_wp_element_["createElement"])(BlockTitle, { - clientId: clientId - }), (blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.anchor) && Object(external_wp_element_["createElement"])("span", { - className: "block-editor-block-navigation-block-select-button__anchor" - }, blockInformation.anchor), isSelected && Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], null, Object(external_wp_i18n_["__"])('(selected block)'))), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-navigation-block-select-button__description", - id: descriptionId - }, blockPositionDescription)); -} - -/* harmony default export */ var block_select_button = (Object(external_wp_element_["forwardRef"])(BlockNavigationBlockSelectButton)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/block-slot.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - - -/** - * Internal dependencies - */ - - - - - - - -const getSlotName = clientId => `BlockNavigationBlock-${clientId}`; - -function BlockNavigationBlockSlot(props, ref) { - const { - clientId - } = props.block; - const { - name - } = Object(external_wp_data_["useSelect"])(select => select(store).getBlockName(clientId), [clientId]); - const instanceId = Object(external_wp_compose_["useInstanceId"])(BlockNavigationBlockSlot); - return Object(external_wp_element_["createElement"])(external_wp_components_["Slot"], { - name: getSlotName(clientId) - }, fills => { - if (!fills.length) { - return Object(external_wp_element_["createElement"])(block_select_button, Object(esm_extends["a" /* default */])({ - ref: ref - }, props)); - } - - const { - className, - isSelected, - position, - siblingBlockCount, - level, - tabIndex, - onFocus - } = props; - const blockType = Object(external_wp_blocks_["getBlockType"])(name); - const descriptionId = `block-navigation-block-slot__${instanceId}`; - const blockPositionDescription = getBlockPositionDescription(position, siblingBlockCount, level); - const forwardedFillProps = { - // Ensure that the component in the slot can receive - // keyboard navigation. - tabIndex, - onFocus, - ref, - // Give the element rendered in the slot a description - // that describes its position. - 'aria-describedby': descriptionId - }; - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { - className: classnames_default()('block-editor-block-navigation-block-slot', className) - }, Object(external_wp_element_["createElement"])(BlockIcon, { - icon: blockType.icon, - showColors: true - }), external_wp_element_["Children"].map(fills, fill => Object(external_wp_element_["cloneElement"])(fill, { ...fill.props, - ...forwardedFillProps - })), isSelected && Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], null, Object(external_wp_i18n_["__"])('(selected block)')), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-navigation-block-slot__description", - id: descriptionId - }, blockPositionDescription))); - }); -} - -/* harmony default export */ var block_slot = (Object(external_wp_element_["forwardRef"])(BlockNavigationBlockSlot)); -const BlockNavigationBlockFill = props => { - const { - clientId - } = Object(external_wp_element_["useContext"])(BlockListBlockContext); - return Object(external_wp_element_["createElement"])(external_wp_components_["Fill"], Object(esm_extends["a" /* default */])({}, props, { - name: getSlotName(clientId) - })); -}; - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/block-contents.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - - - - -const BlockNavigationBlockContents = Object(external_wp_element_["forwardRef"])(({ - onClick, - block, - isSelected, - position, - siblingBlockCount, - level, - ...props -}, ref) => { - const { - __experimentalFeatures, - blockDropTarget = {} - } = useBlockNavigationContext(); - const { - clientId - } = block; - const { - rootClientId, - blockMovingClientId, - selectedBlockInBlockEditor - } = Object(external_wp_data_["useSelect"])(select => { - const { - getBlockRootClientId, - hasBlockMovingClientId, - getSelectedBlockClientId - } = select(store); - return { - rootClientId: getBlockRootClientId(clientId) || '', - blockMovingClientId: hasBlockMovingClientId(), - selectedBlockInBlockEditor: getSelectedBlockClientId() - }; - }, [clientId]); - const isBlockMoveTarget = blockMovingClientId && selectedBlockInBlockEditor === clientId; - const { - rootClientId: dropTargetRootClientId, - clientId: dropTargetClientId, - dropPosition - } = blockDropTarget; - const isDroppingBefore = dropTargetRootClientId === rootClientId && dropTargetClientId === clientId && dropPosition === 'top'; - const isDroppingAfter = dropTargetRootClientId === rootClientId && dropTargetClientId === clientId && dropPosition === 'bottom'; - const isDroppingToInnerBlocks = dropTargetRootClientId === clientId && dropPosition === 'inside'; - const className = classnames_default()('block-editor-block-navigation-block-contents', { - 'is-dropping-before': isDroppingBefore || isBlockMoveTarget, - 'is-dropping-after': isDroppingAfter, - 'is-dropping-to-inner-blocks': isDroppingToInnerBlocks - }); - return Object(external_wp_element_["createElement"])(block_draggable, { - clientIds: [block.clientId], - elementId: `block-navigation-block-${block.clientId}` - }, ({ - draggable, - onDragStart, - onDragEnd - }) => __experimentalFeatures ? Object(external_wp_element_["createElement"])(block_slot, Object(esm_extends["a" /* default */])({ - ref: ref, - className: className, - block: block, - onClick: onClick, - isSelected: isSelected, - position: position, - siblingBlockCount: siblingBlockCount, - level: level, - draggable: draggable && __experimentalFeatures, - onDragStart: onDragStart, - onDragEnd: onDragEnd - }, props)) : Object(external_wp_element_["createElement"])(block_select_button, Object(esm_extends["a" /* default */])({ - ref: ref, - className: className, - block: block, - onClick: onClick, - isSelected: isSelected, - position: position, - siblingBlockCount: siblingBlockCount, - level: level, - draggable: draggable && __experimentalFeatures, - onDragStart: onDragStart, - onDragEnd: onDragEnd - }, props))); -}); -/* harmony default export */ var block_contents = (BlockNavigationBlockContents); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/block.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - - - - - -function BlockNavigationBlock({ - block, - isSelected, - isBranchSelected, - isLastOfSelectedBranch, - onClick, - position, - level, - rowCount, - siblingBlockCount, - showBlockMovers, - path -}) { - const cellRef = Object(external_wp_element_["useRef"])(null); - const [isHovered, setIsHovered] = Object(external_wp_element_["useState"])(false); - const { - clientId - } = block; - const { - isDragging, - blockParents - } = Object(external_wp_data_["useSelect"])(select => { - const { - isBlockBeingDragged, - isAncestorBeingDragged, - getBlockParents - } = select(store); - return { - isDragging: isBlockBeingDragged(clientId) || isAncestorBeingDragged(clientId), - blockParents: getBlockParents(clientId) - }; - }, [clientId]); - const { - selectBlock: selectEditorBlock, - toggleBlockHighlight - } = Object(external_wp_data_["useDispatch"])(store); - const hasSiblings = siblingBlockCount > 0; - const hasRenderedMovers = showBlockMovers && hasSiblings; - const moverCellClassName = classnames_default()('block-editor-block-navigation-block__mover-cell', { - 'is-visible': isHovered - }); - const { - __experimentalFeatures: withExperimentalFeatures, - __experimentalPersistentListViewFeatures: withExperimentalPersistentListViewFeatures, - isTreeGridMounted - } = useBlockNavigationContext(); - const blockNavigationBlockSettingsClassName = classnames_default()('block-editor-block-navigation-block__menu-cell', { - 'is-visible': isHovered - }); // If BlockNavigation has experimental features related to the Persistent List View, - // only focus the selected list item on mount; otherwise the list would always - // try to steal the focus from the editor canvas. - - Object(external_wp_element_["useEffect"])(() => { - if (withExperimentalPersistentListViewFeatures && !isTreeGridMounted && isSelected) { - cellRef.current.focus(); - } - }, []); // If BlockNavigation has experimental features (such as drag and drop) enabled, - // leave the focus handling as it was before, to avoid accidental regressions. - - Object(external_wp_element_["useEffect"])(() => { - if (withExperimentalFeatures && isSelected) { - cellRef.current.focus(); - } - }, [withExperimentalFeatures, isSelected]); - const highlightBlock = withExperimentalPersistentListViewFeatures ? toggleBlockHighlight : () => {}; - - const onMouseEnter = () => { - setIsHovered(true); - highlightBlock(clientId, true); - }; - - const onMouseLeave = () => { - setIsHovered(false); - highlightBlock(clientId, false); - }; - - const classes = classnames_default()({ - 'is-selected': isSelected, - 'is-branch-selected': withExperimentalPersistentListViewFeatures && isBranchSelected, - 'is-last-of-selected-branch': withExperimentalPersistentListViewFeatures && isLastOfSelectedBranch, - 'is-dragging': isDragging - }); - return Object(external_wp_element_["createElement"])(BlockNavigationLeaf, { - className: classes, - onMouseEnter: onMouseEnter, - onMouseLeave: onMouseLeave, - onFocus: onMouseEnter, - onBlur: onMouseLeave, - level: level, - position: position, - rowCount: rowCount, - path: path, - id: `block-navigation-block-${clientId}`, - "data-block": clientId - }, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalTreeGridCell"], { - className: "block-editor-block-navigation-block__contents-cell", - colSpan: hasRenderedMovers ? undefined : 2, - ref: cellRef - }, ({ - ref, - tabIndex, - onFocus - }) => Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-navigation-block__contents-container" - }, Object(external_wp_element_["createElement"])(block_contents, { - block: block, - onClick: () => onClick(block.clientId), - isSelected: isSelected, - position: position, - siblingBlockCount: siblingBlockCount, - level: level, - ref: ref, - tabIndex: tabIndex, - onFocus: onFocus - }))), hasRenderedMovers && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalTreeGridCell"], { - className: moverCellClassName, - withoutGridItem: true - }, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalTreeGridItem"], null, ({ - ref, - tabIndex, - onFocus - }) => Object(external_wp_element_["createElement"])(BlockMoverUpButton, { - orientation: "vertical", - clientIds: [clientId], - ref: ref, - tabIndex: tabIndex, - onFocus: onFocus - })), Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalTreeGridItem"], null, ({ - ref, - tabIndex, - onFocus - }) => Object(external_wp_element_["createElement"])(BlockMoverDownButton, { - orientation: "vertical", - clientIds: [clientId], - ref: ref, - tabIndex: tabIndex, - onFocus: onFocus - })))), withExperimentalFeatures && Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalTreeGridCell"], { - className: blockNavigationBlockSettingsClassName - }, ({ - ref, - tabIndex, - onFocus - }) => Object(external_wp_element_["createElement"])(block_settings_dropdown, { - clientIds: [clientId], - icon: more_vertical["a" /* default */], - toggleProps: { - ref, - tabIndex, - onFocus - }, - disableOpenOnArrowDown: true, - __experimentalSelectBlock: onClick - }, ({ - onClose - }) => Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { - onClick: async () => { - if (blockParents.length) { - // If the block to select is inside a dropdown, we need to open the dropdown. - // Otherwise focus won't transfer to the block. - for (const parent of blockParents) { - await selectEditorBlock(parent); - } - } else { - // If clientId is already selected, it won't be focused (see block-wrapper.js) - // This removes the selection first to ensure the focus will always switch. - await selectEditorBlock(null); - } - - await selectEditorBlock(clientId); - onClose(); - } - }, Object(external_wp_i18n_["__"])('Go to block')))))); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/appender.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - - -function BlockNavigationAppender({ - parentBlockClientId, - position, - level, - rowCount, - path -}) { - const isDragging = Object(external_wp_data_["useSelect"])(select => { - const { - isBlockBeingDragged, - isAncestorBeingDragged - } = select(store); - return isBlockBeingDragged(parentBlockClientId) || isAncestorBeingDragged(parentBlockClientId); - }, [parentBlockClientId]); - const instanceId = Object(external_wp_compose_["useInstanceId"])(BlockNavigationAppender); - const descriptionId = `block-navigation-appender-row__description_${instanceId}`; - const appenderPositionDescription = Object(external_wp_i18n_["sprintf"])( - /* translators: 1: The numerical position of the block that will be inserted. 2: The level of nesting for the block that will be inserted. */ - Object(external_wp_i18n_["__"])('Add block at position %1$d, Level %2$d'), position, level); - return Object(external_wp_element_["createElement"])(BlockNavigationLeaf, { - className: classnames_default()({ - 'is-dragging': isDragging - }), - level: level, - position: position, - rowCount: rowCount, - path: path - }, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalTreeGridCell"], { - className: "block-editor-block-navigation-appender__cell", - colSpan: "3" - }, ({ - ref, - tabIndex, - onFocus - }) => Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-navigation-appender__container" - }, Object(external_wp_element_["createElement"])(inserter, { - rootClientId: parentBlockClientId, - __experimentalIsQuick: true, - "aria-describedby": descriptionId, - toggleProps: { - ref, - tabIndex, - onFocus - } - }), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-navigation-appender__description", - id: descriptionId - }, appenderPositionDescription)))); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/branch.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - - - -function BlockNavigationBranch(props) { - const { - blocks, - selectBlock, - selectedBlockClientIds, - showAppender, - showBlockMovers, - showNestedBlocks, - parentBlockClientId, - level = 1, - terminatedLevels = [], - path = [], - isBranchSelected = false, - isLastOfBranch = false - } = props; - const isTreeRoot = !parentBlockClientId; - const filteredBlocks = Object(external_lodash_["compact"])(blocks); - - const itemHasAppender = parentClientId => showAppender && !isTreeRoot && isClientIdSelected(parentClientId, selectedBlockClientIds); - - const hasAppender = itemHasAppender(parentBlockClientId); // Add +1 to the rowCount to take the block appender into account. - - const blockCount = filteredBlocks.length; - const rowCount = hasAppender ? blockCount + 1 : blockCount; - const appenderPosition = rowCount; - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_lodash_["map"])(filteredBlocks, (block, index) => { - const { - clientId, - innerBlocks - } = block; - const position = index + 1; - const isLastRowAtLevel = rowCount === position; - const updatedTerminatedLevels = isLastRowAtLevel ? [...terminatedLevels, level] : terminatedLevels; - const updatedPath = [...path, position]; - const hasNestedBlocks = showNestedBlocks && !!innerBlocks && !!innerBlocks.length; - const hasNestedAppender = itemHasAppender(clientId); - const hasNestedBranch = hasNestedBlocks || hasNestedAppender; - const isSelected = isClientIdSelected(clientId, selectedBlockClientIds); - const isSelectedBranch = isBranchSelected || isSelected && hasNestedBranch; // Logic needed to target the last item of a selected branch which might be deeply nested. - // This is currently only needed for styling purposes. See: `.is-last-of-selected-branch`. - - const isLastBlock = index === blockCount - 1; - const isLast = isSelected || isLastOfBranch && isLastBlock; - const isLastOfSelectedBranch = isLastOfBranch && !hasNestedBranch && isLastBlock; - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], { - key: clientId - }, Object(external_wp_element_["createElement"])(BlockNavigationBlock, { - block: block, - onClick: selectBlock, - isSelected: isSelected, - isBranchSelected: isSelectedBranch, - isLastOfSelectedBranch: isLastOfSelectedBranch, - level: level, - position: position, - rowCount: rowCount, - siblingBlockCount: blockCount, - showBlockMovers: showBlockMovers, - terminatedLevels: terminatedLevels, - path: updatedPath - }), hasNestedBranch && Object(external_wp_element_["createElement"])(BlockNavigationBranch, { - blocks: innerBlocks, - selectedBlockClientIds: selectedBlockClientIds, - selectBlock: selectBlock, - isBranchSelected: isSelectedBranch, - isLastOfBranch: isLast, - showAppender: showAppender, - showBlockMovers: showBlockMovers, - showNestedBlocks: showNestedBlocks, - parentBlockClientId: clientId, - level: level + 1, - terminatedLevels: updatedTerminatedLevels, - path: updatedPath - })); - }), hasAppender && Object(external_wp_element_["createElement"])(BlockNavigationAppender, { - parentBlockClientId: parentBlockClientId, - position: rowCount, - rowCount: appenderPosition, - level: level, - terminatedLevels: terminatedLevels, - path: [...path, appenderPosition] - })); -} -BlockNavigationBranch.defaultProps = { - selectBlock: () => {} -}; - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/use-block-navigation-client-ids.js -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - - - -const useBlockNavigationSelectedClientIds = __experimentalPersistentListViewFeatures => Object(external_wp_data_["useSelect"])(select => { - const { - getSelectedBlockClientId, - getSelectedBlockClientIds - } = select(store); - - if (__experimentalPersistentListViewFeatures) { - return getSelectedBlockClientIds(); - } - - return getSelectedBlockClientId(); -}, [__experimentalPersistentListViewFeatures]); - -const useBlockNavigationClientIdsTree = (blocks, selectedClientIds, showOnlyCurrentHierarchy) => Object(external_wp_data_["useSelect"])(select => { - const { - getBlockHierarchyRootClientId, - __unstableGetClientIdsTree, - __unstableGetClientIdWithClientIdsTree - } = select(store); - - if (blocks) { - return blocks; - } - - const isSingleBlockSelected = selectedClientIds && !Array.isArray(selectedClientIds); - - if (!showOnlyCurrentHierarchy || !isSingleBlockSelected) { - return __unstableGetClientIdsTree(); - } - - const rootBlock = __unstableGetClientIdWithClientIdsTree(getBlockHierarchyRootClientId(selectedClientIds)); - - if (!rootBlock) { - return __unstableGetClientIdsTree(); - } - - const hasHierarchy = !isClientIdSelected(rootBlock.clientId, selectedClientIds) || rootBlock.innerBlocks && rootBlock.innerBlocks.length !== 0; - - if (hasHierarchy) { - return [rootBlock]; - } - - return __unstableGetClientIdsTree(); -}, [blocks, selectedClientIds, showOnlyCurrentHierarchy]); - -function useBlockNavigationClientIds(blocks, showOnlyCurrentHierarchy, __experimentalPersistentListViewFeatures) { - const selectedClientIds = useBlockNavigationSelectedClientIds(__experimentalPersistentListViewFeatures); - const clientIdsTree = useBlockNavigationClientIdsTree(blocks, selectedClientIds, showOnlyCurrentHierarchy); - return { - clientIdsTree, - selectedClientIds - }; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/use-block-navigation-drop-zone.js -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - - -/** @typedef {import('../../utils/math').WPPoint} WPPoint */ - -/** - * The type of a drag event. - * - * @typedef {'default'|'file'|'html'} WPDragEventType - */ - -/** - * An array representing data for blocks in the DOM used by drag and drop. - * - * @typedef {Object} WPBlockNavigationDropZoneBlocks - * @property {string} clientId The client id for the block. - * @property {string} rootClientId The root client id for the block. - * @property {number} blockIndex The block's index. - * @property {Element} element The DOM element representing the block. - * @property {number} innerBlockCount The number of inner blocks the block has. - * @property {boolean} isDraggedBlock Whether the block is currently being dragged. - * @property {boolean} canInsertDraggedBlocksAsSibling Whether the dragged block can be a sibling of this block. - * @property {boolean} canInsertDraggedBlocksAsChild Whether the dragged block can be a child of this block. - */ - -/** - * An object containing details of a drop target. - * - * @typedef {Object} WPBlockNavigationDropZoneTarget - * @property {string} blockIndex The insertion index. - * @property {string} rootClientId The root client id for the block. - * @property {string|undefined} clientId The client id for the block. - * @property {'top'|'bottom'|'inside'} dropPosition The position relative to the block that the user is dropping to. - * 'inside' refers to nesting as an inner block. - */ - -/** - * Is the point contained by the rectangle. - * - * @param {WPPoint} point The point. - * @param {DOMRect} rect The rectangle. - * - * @return {boolean} True if the point is contained by the rectangle, false otherwise. - */ - -function isPointContainedByRect(point, rect) { - return rect.left <= point.x && rect.right >= point.x && rect.top <= point.y && rect.bottom >= point.y; -} -/** - * Determines whether the user positioning the dragged block to nest as an - * inner block. - * - * Presently this is determined by whether the cursor is on the right hand side - * of the block. - * - * @param {WPPoint} point The point representing the cursor position when dragging. - * @param {DOMRect} rect The rectangle. - */ - - -function isNestingGesture(point, rect) { - const blockCenterX = rect.left + rect.width / 2; - return point.x > blockCenterX; -} // Block navigation is always a vertical list, so only allow dropping -// to the above or below a block. - - -const ALLOWED_DROP_EDGES = ['top', 'bottom']; -/** - * Given blocks data and the cursor position, compute the drop target. - * - * @param {WPBlockNavigationDropZoneBlocks} blocksData Data about the blocks in block navigation. - * @param {WPPoint} position The point representing the cursor position when dragging. - * - * @return {WPBlockNavigationDropZoneTarget} An object containing data about the drop target. - */ - -function getBlockNavigationDropTarget(blocksData, position) { - let candidateEdge; - let candidateBlockData; - let candidateDistance; - let candidateRect; - - for (const blockData of blocksData) { - if (blockData.isDraggedBlock) { - continue; - } - - const rect = blockData.element.getBoundingClientRect(); - const [distance, edge] = getDistanceToNearestEdge(position, rect, ALLOWED_DROP_EDGES); - const isCursorWithinBlock = isPointContainedByRect(position, rect); - - if (candidateDistance === undefined || distance < candidateDistance || isCursorWithinBlock) { - candidateDistance = distance; - const index = blocksData.indexOf(blockData); - const previousBlockData = blocksData[index - 1]; // If dragging near the top of a block and the preceding block - // is at the same level, use the preceding block as the candidate - // instead, as later it makes determining a nesting drop easier. - - if (edge === 'top' && previousBlockData && previousBlockData.rootClientId === blockData.rootClientId && !previousBlockData.isDraggedBlock) { - candidateBlockData = previousBlockData; - candidateEdge = 'bottom'; - candidateRect = previousBlockData.element.getBoundingClientRect(); - } else { - candidateBlockData = blockData; - candidateEdge = edge; - candidateRect = rect; - } // If the mouse position is within the block, break early - // as the user would intend to drop either before or after - // this block. - // - // This solves an issue where some rows in the block navigation - // tree overlap slightly due to sub-pixel rendering. - - - if (isCursorWithinBlock) { - break; - } - } - } - - if (!candidateBlockData) { - return; - } - - const isDraggingBelow = candidateEdge === 'bottom'; // If the user is dragging towards the bottom of the block check whether - // they might be trying to nest the block as a child. - // If the block already has inner blocks, this should always be treated - // as nesting since the next block in the tree will be the first child. - - if (isDraggingBelow && candidateBlockData.canInsertDraggedBlocksAsChild && (candidateBlockData.innerBlockCount > 0 || isNestingGesture(position, candidateRect))) { - return { - rootClientId: candidateBlockData.clientId, - blockIndex: 0, - dropPosition: 'inside' - }; - } // If dropping as a sibling, but block cannot be inserted in - // this context, return early. - - - if (!candidateBlockData.canInsertDraggedBlocksAsSibling) { - return; - } - - const offset = isDraggingBelow ? 1 : 0; - return { - rootClientId: candidateBlockData.rootClientId, - clientId: candidateBlockData.clientId, - blockIndex: candidateBlockData.blockIndex + offset, - dropPosition: candidateEdge - }; -} -/** - * A react hook for implementing a drop zone in block navigation. - * - * @return {WPBlockNavigationDropZoneTarget} The drop target. - */ - - -function useBlockNavigationDropZone() { - const { - getBlockRootClientId, - getBlockIndex, - getBlockCount, - getDraggedBlockClientIds, - canInsertBlocks - } = Object(external_wp_data_["useSelect"])(store); - const [target, setTarget] = Object(external_wp_element_["useState"])(); - const { - rootClientId: targetRootClientId, - blockIndex: targetBlockIndex - } = target || {}; - const onBlockDrop = useOnBlockDrop(targetRootClientId, targetBlockIndex); - const throttled = Object(external_wp_compose_["useThrottle"])(Object(external_wp_element_["useCallback"])((event, currentTarget) => { - const position = { - x: event.clientX, - y: event.clientY - }; - const isBlockDrag = !!event.dataTransfer.getData('wp-blocks'); - const draggedBlockClientIds = isBlockDrag ? getDraggedBlockClientIds() : undefined; - const blockElements = Array.from(currentTarget.querySelectorAll('[data-block]')); - const blocksData = blockElements.map(blockElement => { - const clientId = blockElement.dataset.block; - const rootClientId = getBlockRootClientId(clientId); - return { - clientId, - rootClientId, - blockIndex: getBlockIndex(clientId, rootClientId), - element: blockElement, - isDraggedBlock: isBlockDrag ? draggedBlockClientIds.includes(clientId) : false, - innerBlockCount: getBlockCount(clientId), - canInsertDraggedBlocksAsSibling: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, rootClientId) : true, - canInsertDraggedBlocksAsChild: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, clientId) : true - }; - }); - const newTarget = getBlockNavigationDropTarget(blocksData, position); - - if (newTarget) { - setTarget(newTarget); - } - }, []), 200); - const ref = Object(external_wp_compose_["__experimentalUseDropZone"])({ - onDrop: onBlockDrop, - - onDragOver(event) { - // `currentTarget` is only available while the event is being - // handled, so get it now and pass it to the thottled function. - // https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget - throttled(event, event.currentTarget); - }, - - onDragEnd() { - throttled.cancel(); - setTarget(null); - } - - }); - return { - ref, - target - }; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/tree.js - - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - - - - -const noop = () => {}; -/** - * Wrap `BlockNavigationRows` with `TreeGrid`. BlockNavigationRows is a - * recursive component (it renders itself), so this ensures TreeGrid is only - * present at the very top of the navigation grid. - * - * @param {Object} props Components props. - * @param {Array} props.blocks Custom subset of block client IDs to be used instead of the default hierarchy. - * @param {Function} props.onSelect Block selection callback. - * @param {boolean} props.showNestedBlocks Flag to enable displaying nested blocks. - * @param {boolean} props.showOnlyCurrentHierarchy Flag to limit the list to the current hierarchy of blocks. - * @param {boolean} props.__experimentalFeatures Flag to enable experimental features. - * @param {boolean} props.__experimentalPersistentListViewFeatures Flag to enable features for the Persistent List View experiment. - */ - - -function BlockNavigationTree({ - blocks, - showOnlyCurrentHierarchy, - onSelect = noop, - __experimentalFeatures, - __experimentalPersistentListViewFeatures, - ...props -}) { - const { - clientIdsTree, - selectedClientIds - } = useBlockNavigationClientIds(blocks, showOnlyCurrentHierarchy, __experimentalPersistentListViewFeatures); + const startPath = [...getBlockParents(startClientId), startClientId]; + const endPath = [...getBlockParents(endClientId), endClientId]; + const depth = findDepth(startPath, endPath); + multiSelect(startPath[depth], endPath[depth]); + } + } + + function addListeners() { + ownerDocument.addEventListener('selectionchange', onSelectionChange); + defaultView.addEventListener('mouseup', onSelectionChange); + } + + function removeListeners() { + ownerDocument.removeEventListener('selectionchange', onSelectionChange); + defaultView.removeEventListener('mouseup', onSelectionChange); + } + + function resetListeners() { + removeListeners(); + addListeners(); + } + + addListeners(); // We must allow rich text to set selection first. This ensures that + // our `selectionchange` listener is always reset to be called after + // the rich text one. + + node.addEventListener('focusin', resetListeners); + return () => { + removeListeners(); + node.removeEventListener('focusin', resetListeners); + }; + }, [multiSelect, selectBlock, selectionChange, getBlockParents]); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-click-selection.js +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + +function useClickSelection() { const { selectBlock - } = Object(external_wp_data_["useDispatch"])(store); - const selectEditorBlock = Object(external_wp_element_["useCallback"])(clientId => { - selectBlock(clientId); - onSelect(clientId); - }, [selectBlock, onSelect]); - let { - ref: treeGridRef, - target: blockDropTarget - } = useBlockNavigationDropZone(); - const isMounted = Object(external_wp_element_["useRef"])(false); - Object(external_wp_element_["useEffect"])(() => { - isMounted.current = true; - }, []); - - if (!__experimentalFeatures) { - blockDropTarget = undefined; - } - - const contextValue = Object(external_wp_element_["useMemo"])(() => ({ - __experimentalFeatures, - __experimentalPersistentListViewFeatures, - blockDropTarget, - isTreeGridMounted: isMounted.current - }), [__experimentalFeatures, __experimentalPersistentListViewFeatures, blockDropTarget, isMounted.current]); - return Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalTreeGrid"], { - className: "block-editor-block-navigation-tree", - "aria-label": Object(external_wp_i18n_["__"])('Block navigation structure'), - ref: treeGridRef - }, Object(external_wp_element_["createElement"])(BlockNavigationContext.Provider, { - value: contextValue - }, Object(external_wp_element_["createElement"])(BlockNavigationBranch, Object(esm_extends["a" /* default */])({ - blocks: clientIdsTree, - selectBlock: selectEditorBlock, - selectedBlockClientIds: selectedClientIds - }, props)))); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/dropdown.js - - - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - - -function BlockNavigationDropdownToggle({ - isEnabled, - onToggle, - isOpen, - innerRef, - ...props -}) { - return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, { - ref: innerRef, - icon: list_view["a" /* default */], - "aria-expanded": isOpen, - "aria-haspopup": "true", - onClick: isEnabled ? onToggle : undefined - /* translators: button label text should, if possible, be under 16 characters. */ - , - label: Object(external_wp_i18n_["__"])('List view'), - className: "block-editor-block-navigation", - "aria-disabled": !isEnabled - })); -} - -function BlockNavigationDropdown({ - isDisabled, - __experimentalFeatures, - ...props -}, ref) { - const hasBlocks = Object(external_wp_data_["useSelect"])(select => !!select(store).getBlockCount(), []); - const isEnabled = hasBlocks && !isDisabled; - return Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], { - contentClassName: "block-editor-block-navigation__popover", - position: "bottom right", - renderToggle: ({ - isOpen, - onToggle - }) => Object(external_wp_element_["createElement"])(BlockNavigationDropdownToggle, Object(esm_extends["a" /* default */])({}, props, { - innerRef: ref, - isOpen: isOpen, - onToggle: onToggle, - isEnabled: isEnabled - })), - renderContent: () => Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-navigation__container" - }, Object(external_wp_element_["createElement"])("p", { - className: "block-editor-block-navigation__label" - }, Object(external_wp_i18n_["__"])('List view')), Object(external_wp_element_["createElement"])(BlockNavigationTree, { - showNestedBlocks: true, - showOnlyCurrentHierarchy: true, - __experimentalFeatures: __experimentalFeatures - })) - }); -} - -/* harmony default export */ var dropdown = (Object(external_wp_element_["forwardRef"])(BlockNavigationDropdown)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/remove-browser-shortcuts.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - -/** - * Set of keyboard shortcuts handled internally by RichText. - * - * @type {Array} - */ - -const HANDLED_SHORTCUTS = [external_wp_keycodes_["rawShortcut"].primary('z'), external_wp_keycodes_["rawShortcut"].primaryShift('z'), external_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} - */ - -const SHORTCUTS_ELEMENT = Object(external_wp_element_["createElement"])(external_wp_components_["KeyboardShortcuts"], { - bindGlobal: true, - shortcuts: Object(external_lodash_["fromPairs"])(HANDLED_SHORTCUTS.map(shortcut => { - return [shortcut, event => event.preventDefault()]; - })) -}); -/** - * Component which registered keyboard event handlers to prevent default - * behaviors for key combinations otherwise handled internally by RichText. - * - * @return {WPComponent} The component to be rendered. - */ - -const RemoveBrowserShortcuts = () => SHORTCUTS_ELEMENT; - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-toolbar/index.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - -const format_toolbar_POPOVER_PROPS = { - position: 'bottom right', - isAlternate: true -}; - -const FormatToolbar = () => { - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, ['bold', 'italic', 'link', 'text-color'].map(format => Object(external_wp_element_["createElement"])(external_wp_components_["Slot"], { - name: `RichText.ToolbarControls.${format}`, - key: format - })), Object(external_wp_element_["createElement"])(external_wp_components_["Slot"], { - name: "RichText.ToolbarControls" - }, fills => fills.length !== 0 && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], null, toggleProps => Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], { - icon: chevron_down["a" /* default */] - /* translators: button label text should, if possible, be under 16 characters. */ - , - label: Object(external_wp_i18n_["__"])('More'), - toggleProps: toggleProps, - controls: Object(external_lodash_["orderBy"])(fills.map(([{ - props - }]) => props), 'title'), - popoverProps: format_toolbar_POPOVER_PROPS - })))); -}; - -/* harmony default export */ var format_toolbar = (FormatToolbar); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-toolbar-container.js - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - - - -const FormatToolbarContainer = ({ - inline, - anchorRef -}) => { - if (inline) { - // Render in popover - return Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], { - noArrow: true, - position: "top center", - focusOnMount: false, - anchorRef: anchorRef, - className: "block-editor-rich-text__inline-format-toolbar", - __unstableSlotName: "block-toolbar" - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-rich-text__inline-format-toolbar-group" - }, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(format_toolbar, null)))); - } // Render regular toolbar - - - return Object(external_wp_element_["createElement"])(block_controls, { - group: "inline" - }, Object(external_wp_element_["createElement"])(format_toolbar, null)); -}; - -/* harmony default export */ var format_toolbar_container = (FormatToolbarContainer); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-undo-automatic-change.js -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - -function useUndoAutomaticChange() { - const { - didAutomaticChange, - getSettings - } = Object(external_wp_data_["useSelect"])(store); - return Object(external_wp_compose_["useRefEffect"])(element => { + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const { + isSelectionEnabled, + getBlockSelectionStart, + hasMultiSelection + } = (0,external_wp_data_namespaceObject.useSelect)(store); + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { + function onMouseDown(event) { + // The main button. + // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button + if (!isSelectionEnabled() || event.button !== 0) { + return; + } + + const startClientId = getBlockSelectionStart(); + const clickedClientId = getBlockClientId(event.target); + + if (event.shiftKey) { + if (startClientId !== clickedClientId) { + node.contentEditable = true; // Firefox doesn't automatically move focus. + + node.focus(); + } + } else if (hasMultiSelection()) { + // Allow user to escape out of a multi-selection to a + // singular selection of a block via click. This is handled + // here since focus handling excludes blocks when there is + // multiselection, as focus can be incurred by starting a + // multiselection (focus moved to first block's multi- + // controls). + selectBlock(clickedClientId); + } + } + + node.addEventListener('mousedown', onMouseDown); + return () => { + node.removeEventListener('mousedown', onMouseDown); + }; + }, [selectBlock, isSelectionEnabled, getBlockSelectionStart, hasMultiSelection]); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-input.js +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + +/** + * Handles input for selections across blocks. + */ + +function useInput() { + const { + __unstableIsFullySelected, + getSelectedBlockClientIds, + __unstableIsSelectionMergeable, + hasMultiSelection + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const { + replaceBlocks, + __unstableSplitSelection, + removeBlocks, + __unstableDeleteSelection, + __unstableExpandSelection + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { function onKeyDown(event) { - const { - keyCode - } = event; - - if (keyCode !== external_wp_keycodes_["DELETE"] && keyCode !== external_wp_keycodes_["BACKSPACE"] && keyCode !== external_wp_keycodes_["ESCAPE"]) { - return; - } - - if (!didAutomaticChange()) { - return; - } - - event.preventDefault(); - - getSettings().__experimentalUndo(); - } - - element.addEventListener('keydown', onKeyDown); + if (event.defaultPrevented) { + return; + } + + if (!hasMultiSelection()) { + return; + } + + if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { + node.contentEditable = false; + event.preventDefault(); + + if (__unstableIsFullySelected()) { + replaceBlocks(getSelectedBlockClientIds(), (0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)())); + } else { + __unstableSplitSelection(); + } + } else if (event.keyCode === external_wp_keycodes_namespaceObject.BACKSPACE || event.keyCode === external_wp_keycodes_namespaceObject.DELETE) { + node.contentEditable = false; + event.preventDefault(); + + if (__unstableIsFullySelected()) { + removeBlocks(getSelectedBlockClientIds()); + } else if (__unstableIsSelectionMergeable()) { + __unstableDeleteSelection(event.keyCode === external_wp_keycodes_namespaceObject.DELETE); + } else { + __unstableExpandSelection(); + } + } else if ( // If key.length is longer than 1, it's a control key that doesn't + // input anything. + event.key.length === 1 && !(event.metaKey || event.ctrlKey)) { + node.contentEditable = false; + + if (__unstableIsSelectionMergeable()) { + __unstableDeleteSelection(event.keyCode === external_wp_keycodes_namespaceObject.DELETE); + } else { + event.preventDefault(); // Safari does not stop default behaviour with either + // event.preventDefault() or node.contentEditable = false, so + // remove the selection to stop browser manipulation. + + node.ownerDocument.defaultView.getSelection().removeAllRanges(); + } + } + } + + function onCompositionStart(event) { + if (!hasMultiSelection()) { + return; + } + + node.contentEditable = false; + + if (__unstableIsSelectionMergeable()) { + __unstableDeleteSelection(); + } else { + event.preventDefault(); // Safari does not stop default behaviour with either + // event.preventDefault() or node.contentEditable = false, so + // remove the selection to stop browser manipulation. + + node.ownerDocument.defaultView.getSelection().removeAllRanges(); + } + } + + node.addEventListener('keydown', onKeyDown); + node.addEventListener('compositionstart', onCompositionStart); return () => { - element.removeEventListener('keydown', onKeyDown); + node.removeEventListener('keydown', onKeyDown); + node.removeEventListener('compositionstart', onCompositionStart); }; }, []); } -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-caret-in-format.js -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -function useCaretInFormat({ - value -}) { - const hasActiveFormats = value.activeFormats && !!value.activeFormats.length; - const { - isCaretWithinFormattedText - } = Object(external_wp_data_["useSelect"])(store); - const { - enterFormattedText, - exitFormattedText - } = Object(external_wp_data_["useDispatch"])(store); - Object(external_wp_element_["useEffect"])(() => { - if (hasActiveFormats) { - if (!isCaretWithinFormattedText()) { - enterFormattedText(); - } - } else if (isCaretWithinFormattedText()) { - exitFormattedText(); - } - }, [hasActiveFormats]); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-mark-persistent.js -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -function useMarkPersistent({ - html, - value -}) { - const previousText = Object(external_wp_element_["useRef"])(); - const hasActiveFormats = value.activeFormats && !!value.activeFormats.length; - const { - __unstableMarkLastChangeAsPersistent - } = Object(external_wp_data_["useDispatch"])(store); // Must be set synchronously to make sure it applies to the last change. - - Object(external_wp_element_["useLayoutEffect"])(() => { - // Ignore mount. - if (!previousText.current) { - previousText.current = value.text; - return; - } // Text input, so don't create an undo level for every character. - // Create an undo level after 1 second of no input. - - - if (previousText.current !== value.text) { - const timeout = window.setTimeout(() => { - __unstableMarkLastChangeAsPersistent(); - }, 1000); - previousText.current = value.text; - return () => { - window.clearTimeout(timeout); - }; - } - - __unstableMarkLastChangeAsPersistent(); - }, [html, hasActiveFormats]); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/file-paste-handler.js -/** - * WordPress dependencies - */ - -function filePasteHandler(files) { - return files.filter(({ - type - }) => /^image\/(?:jpe?g|png|gif)$/.test(type)).map(file => ``).join(''); -} - -// EXTERNAL MODULE: external ["wp","shortcode"] -var external_wp_shortcode_ = __webpack_require__("SVSp"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/utils.js -/** - * WordPress dependencies - */ - - -function addActiveFormats(value, activeFormats) { - if (activeFormats !== null && activeFormats !== void 0 && activeFormats.length) { - let index = value.formats.length; - - while (index--) { - value.formats[index] = [...activeFormats, ...(value.formats[index] || [])]; - } - } -} -/** - * Get the multiline tag based on the multiline prop. - * - * @param {?(string|boolean)} multiline The multiline prop. - * - * @return {?string} The multiline tag. - */ - -function getMultilineTag(multiline) { - if (multiline !== true && multiline !== 'p' && multiline !== 'li') { - return; - } - - return multiline === true ? 'p' : multiline; -} -function getAllowedFormats({ - allowedFormats, - formattingControls, - disableFormats -}) { - if (disableFormats) { - return getAllowedFormats.EMPTY_ARRAY; - } - - if (!allowedFormats && !formattingControls) { - return; - } - - if (allowedFormats) { - return allowedFormats; - } - - external_wp_deprecated_default()('wp.blockEditor.RichText formattingControls prop', { - since: '5.4', - alternative: 'allowedFormats' - }); - return formattingControls.map(name => `core/${name}`); -} -getAllowedFormats.EMPTY_ARRAY = []; -const isShortcode = text => Object(external_wp_shortcode_["regexp"])('.*').test(text); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/split-value.js -/** - * WordPress dependencies - */ - -/* - * Signals to the RichText owner that the block can be replaced with two blocks - * as a result of splitting the block by pressing enter, or with blocks as a - * result of splitting the block by pasting block content in the instance. - */ - -function splitValue({ - value, - pastedBlocks = [], - onReplace, - onSplit, - onSplitMiddle, - multilineTag -}) { - if (!onReplace || !onSplit) { - return; - } - - const blocks = []; - const [before, after] = Object(external_wp_richText_["split"])(value); - const hasPastedBlocks = pastedBlocks.length > 0; - let lastPastedBlockIndex = -1; // Consider the after value to be the original it is not empty and the - // before value *is* empty. - - const isAfterOriginal = Object(external_wp_richText_["isEmpty"])(before) && !Object(external_wp_richText_["isEmpty"])(after); // Create a block with the content before the caret if there's no pasted - // blocks, or if there are pasted blocks and the value is not empty. We do - // not want a leading empty block on paste, but we do if split with e.g. the - // enter key. - - if (!hasPastedBlocks || !Object(external_wp_richText_["isEmpty"])(before)) { - blocks.push(onSplit(Object(external_wp_richText_["toHTMLString"])({ - value: before, - multilineTag - }), !isAfterOriginal)); - lastPastedBlockIndex += 1; - } - - if (hasPastedBlocks) { - blocks.push(...pastedBlocks); - lastPastedBlockIndex += pastedBlocks.length; - } else if (onSplitMiddle) { - blocks.push(onSplitMiddle()); - } // If there's pasted blocks, append a block with non empty content / after - // the caret. Otherwise, do append an empty block if there is no - // `onSplitMiddle` prop, but if there is and the content is empty, the - // middle block is enough to set focus in. - - - if (hasPastedBlocks ? !Object(external_wp_richText_["isEmpty"])(after) : !onSplitMiddle || !Object(external_wp_richText_["isEmpty"])(after)) { - blocks.push(onSplit(Object(external_wp_richText_["toHTMLString"])({ - value: after, - multilineTag - }), isAfterOriginal)); - } // If there are pasted blocks, set the selection to the last one. Otherwise, - // set the selection to the second block. - - - const indexToSelect = hasPastedBlocks ? lastPastedBlockIndex : 1; // If there are pasted blocks, move the caret to the end of the selected - // block Otherwise, retain the default value. - - const initialPosition = hasPastedBlocks ? -1 : 0; - onReplace(blocks, indexToSelect, initialPosition); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-paste-handler.js -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - - -function usePasteHandler(props) { - const propsRef = Object(external_wp_element_["useRef"])(props); - propsRef.current = props; - return Object(external_wp_compose_["useRefEffect"])(element => { - function _onPaste(event) { - const { - isSelected, - disableFormats, - onChange, - value, - formatTypes, - tagName, - onReplace, - onSplit, - onSplitMiddle, - __unstableEmbedURLOnPaste, - multilineTag, - preserveWhiteSpace, - pastePlainText - } = propsRef.current; - - if (!isSelected) { - event.preventDefault(); - return; - } - - const { - clipboardData - } = event; - let plainText = ''; - let 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. - +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/index.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + + + + + + + + +function useWritingFlow() { + const [before, ref, after] = useTabNav(); + const hasMultiSelection = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).hasMultiSelection(), []); + return [before, (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, useInput(), useDragSelection(), useSelectionObserver(), useClickSelection(), useMultiSelection(), useSelectAll(), useArrowNav(), (0,external_wp_compose_namespaceObject.useRefEffect)(node => { + node.tabIndex = -1; + node.contentEditable = hasMultiSelection; + + if (!hasMultiSelection) { + return; + } + + node.setAttribute('aria-label', (0,external_wp_i18n_namespaceObject.__)('Multiple selected blocks')); + return () => { + node.removeAttribute('aria-label'); + }; + }, [hasMultiSelection])]), after]; +} + +function WritingFlow(_ref, forwardedRef) { + let { + children, + ...props + } = _ref; + const [before, ref, after] = useWritingFlow(); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, before, (0,external_wp_element_namespaceObject.createElement)("div", _extends({}, props, { + ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, forwardedRef]), + className: classnames_default()(props.className, 'block-editor-writing-flow') + }), children), after); +} +/** + * Handles selection and navigation across blocks. This component should be + * wrapped around BlockList. + * + * @param {Object} props Component properties. + * @param {WPElement} props.children Children to be rendered. + */ + + +/* harmony default export */ var writing_flow = ((0,external_wp_element_namespaceObject.forwardRef)(WritingFlow)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/iframe/index.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + +const BODY_CLASS_NAME = 'editor-styles-wrapper'; +const BLOCK_PREFIX = 'wp-block'; +/** + * Clones stylesheets targetting the editor canvas to the given document. A + * stylesheet is considered targetting the editor a canvas if it contains the + * `editor-styles-wrapper`, `wp-block`, or `wp-block-*` class selectors. + * + * Ideally, this hook should be removed in the future and styles should be added + * explicitly as editor styles. + */ + +function useStylesCompatibility() { + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { + // Search the document for stylesheets targetting the editor canvas. + Array.from(document.styleSheets).forEach(styleSheet => { 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); - - if (disableFormats) { - onChange(Object(external_wp_richText_["insert"])(value, plainText)); - return; - } - - const transformed = formatTypes.reduce((accumlator, { - __unstablePasteRule - }) => { - // Only allow one transform. - if (__unstablePasteRule && accumlator === value) { - accumlator = __unstablePasteRule(value, { - html, - plainText - }); - } - - return accumlator; - }, value); - - if (transformed !== value) { - onChange(transformed); - return; - } - - const files = [...Object(external_wp_dom_["getFilesFromDataTransfer"])(clipboardData)]; - const isInternal = clipboardData.getData('rich-text') === 'true'; // If the data comes from a rich text instance, we can directly use it - // without filtering the data. The filters are only meant for externally - // pasted content and remove inline styles. - - if (isInternal) { - const pastedValue = Object(external_wp_richText_["create"])({ - html, - multilineTag, - multilineWrapperTags: multilineTag === 'li' ? ['ul', 'ol'] : undefined, - preserveWhiteSpace - }); - addActiveFormats(pastedValue, value.activeFormats); - onChange(Object(external_wp_richText_["insert"])(value, pastedValue)); - return; - } - - if (pastePlainText) { - onChange(Object(external_wp_richText_["insert"])(value, Object(external_wp_richText_["create"])({ - text: plainText - }))); - return; - } // Only process file if no HTML is present. - // Note: a pasted file may have the URL as plain text. - - - if (files && files.length && !html) { - const content = Object(external_wp_blocks_["pasteHandler"])({ - HTML: filePasteHandler(files), - mode: 'BLOCKS', - tagName, - preserveWhiteSpace - }); // Allows us to ask for this information when we get a report. - // eslint-disable-next-line no-console - - window.console.log('Received items:\n\n', files); - - if (onReplace && Object(external_wp_richText_["isEmpty"])(value)) { - onReplace(content); - } else { - splitValue({ - value, - pastedBlocks: content, - onReplace, - onSplit, - onSplitMiddle, - multilineTag - }); - } - - return; - } - - let mode = onReplace && onSplit ? 'AUTO' : 'INLINE'; // Force the blocks mode when the user is pasting - // on a new line & the content resembles a shortcode. - // Otherwise it's going to be detected as inline - // and the shortcode won't be replaced. - - if (mode === 'AUTO' && Object(external_wp_richText_["isEmpty"])(value) && isShortcode(plainText)) { - mode = 'BLOCKS'; - } - - if (__unstableEmbedURLOnPaste && Object(external_wp_richText_["isEmpty"])(value) && Object(external_wp_url_["isURL"])(plainText.trim())) { - mode = 'BLOCKS'; - } - - const content = Object(external_wp_blocks_["pasteHandler"])({ - HTML: html, - plainText, - mode, - tagName, - preserveWhiteSpace - }); - - if (typeof content === 'string') { - let valueToInsert = Object(external_wp_richText_["create"])({ - html: content - }); - addActiveFormats(valueToInsert, value.activeFormats); // If the content should be multiline, we should process text - // separated by a line break as separate lines. - - if (multilineTag) { - valueToInsert = Object(external_wp_richText_["replace"])(valueToInsert, /\n+/g, external_wp_richText_["__UNSTABLE_LINE_SEPARATOR"]); - } - - onChange(Object(external_wp_richText_["insert"])(value, valueToInsert)); - } else if (content.length > 0) { - if (onReplace && Object(external_wp_richText_["isEmpty"])(value)) { - onReplace(content, content.length - 1, -1); - } else { - splitValue({ - value, - pastedBlocks: content, - onReplace, - onSplit, - onSplitMiddle, - multilineTag - }); - } - } - } - - element.addEventListener('paste', _onPaste); - return () => { - element.removeEventListener('paste', _onPaste); - }; - }, []); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-input-rules.js -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - -function useInputRules(props) { - const { - __unstableMarkLastChangeAsPersistent, - __unstableMarkAutomaticChange - } = Object(external_wp_data_["useDispatch"])(store); - const propsRef = Object(external_wp_element_["useRef"])(props); - propsRef.current = props; - return Object(external_wp_compose_["useRefEffect"])(element => { - function inputRule() { - const { - value, - onReplace - } = propsRef.current; - - if (!onReplace) { - return; - } - - const { - start, - text - } = value; - const characterBefore = text.slice(start - 1, start); // The character right before the caret must be a plain space. - - if (characterBefore !== ' ') { - return; - } - - const trimmedTextBefore = text.slice(0, start).trim(); - const prefixTransforms = Object(external_wp_blocks_["getBlockTransforms"])('from').filter(({ - type - }) => type === 'prefix'); - const transformation = Object(external_wp_blocks_["findTransform"])(prefixTransforms, ({ - prefix - }) => { - return trimmedTextBefore === prefix; - }); - - if (!transformation) { - return; - } - - const content = Object(external_wp_richText_["toHTMLString"])({ - value: Object(external_wp_richText_["slice"])(value, start, text.length) - }); - const block = transformation.transform(content); - onReplace([block]); - - __unstableMarkAutomaticChange(); - } - - function onInput(event) { - const { - inputType, - type - } = event; - const { - value, - onChange, - __unstableAllowPrefixTransformations, - formatTypes - } = propsRef.current; // Only run input rules when inserting text. - - if (inputType !== 'insertText' && type !== 'compositionend') { - return; - } - - if (__unstableAllowPrefixTransformations && inputRule) { - inputRule(); - } - - const transformed = formatTypes.reduce((accumlator, { - __unstableInputRule - }) => { - if (__unstableInputRule) { - accumlator = __unstableInputRule(accumlator); - } - - return accumlator; - }, value); - - if (transformed !== value) { - __unstableMarkLastChangeAsPersistent(); - - onChange({ ...transformed, - activeFormats: value.activeFormats - }); - - __unstableMarkAutomaticChange(); - } - } - - element.addEventListener('input', onInput); - element.addEventListener('compositionend', onInput); - return () => { - element.removeEventListener('input', onInput); - element.removeEventListener('compositionend', onInput); - }; - }, []); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-enter.js -/** - * WordPress dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - -function useEnter(props) { - const { - __unstableMarkAutomaticChange - } = Object(external_wp_data_["useDispatch"])(store); - const propsRef = Object(external_wp_element_["useRef"])(props); - propsRef.current = props; - return Object(external_wp_compose_["useRefEffect"])(element => { - function onKeyDown(event) { - if (event.defaultPrevented) { + // May fail for external styles. + // eslint-disable-next-line no-unused-expressions + styleSheet.cssRules; + } catch (e) { return; } const { - removeEditorOnlyFormats, - value, - onReplace, - onSplit, - onSplitMiddle, - multilineTag, - onChange, - disableLineBreaks, - onSplitAtEnd - } = propsRef.current; - - if (event.keyCode !== external_wp_keycodes_["ENTER"]) { - return; - } - + ownerNode, + cssRules + } = styleSheet; + + if (!cssRules) { + return; + } // Generally, ignore inline styles. We add inline styles belonging to a + // stylesheet later, which may or may not match the selectors. + + + if (ownerNode.tagName !== 'LINK') { + return; + } // Don't try to add the reset styles, which were removed as a dependency + // from `edit-blocks` for the iframe since we don't need to reset admin + // styles. + + + if (ownerNode.id === 'wp-reset-editor-styles-css') { + return; + } + + const isMatch = Array.from(cssRules).find(_ref => { + let { + selectorText + } = _ref; + return selectorText && (selectorText.includes(`.${BODY_CLASS_NAME}`) || selectorText.includes(`.${BLOCK_PREFIX}`)); + }); + + if (isMatch && !node.ownerDocument.getElementById(ownerNode.id)) { + // Display warning once we have a way to add style dependencies to the editor. + // See: https://github.com/WordPress/gutenberg/pull/37466. + node.appendChild(ownerNode.cloneNode(true)); // Add inline styles belonging to the stylesheet. + + const inlineCssId = ownerNode.id.replace('-css', '-inline-css'); + const inlineCssElement = document.getElementById(inlineCssId); + + if (inlineCssElement) { + node.appendChild(inlineCssElement.cloneNode(true)); + } + } + }); + }, []); +} +/** + * Bubbles some event types (keydown, keypress, and dragover) to parent document + * document to ensure that the keyboard shortcuts and drag and drop work. + * + * Ideally, we should remove event bubbling in the future. Keyboard shortcuts + * should be context dependent, e.g. actions on blocks like Cmd+A should not + * work globally outside the block editor. + * + * @param {Document} doc Document to attach listeners to. + */ + + +function bubbleEvents(doc) { + const { + defaultView + } = doc; + const { + frameElement + } = defaultView; + + function bubbleEvent(event) { + const prototype = Object.getPrototypeOf(event); + const constructorName = prototype.constructor.name; + const Constructor = window[constructorName]; + const init = {}; + + for (const key in event) { + init[key] = event[key]; + } + + if (event instanceof defaultView.MouseEvent) { + const rect = frameElement.getBoundingClientRect(); + init.clientX += rect.left; + init.clientY += rect.top; + } + + const newEvent = new Constructor(event.type, init); + const cancelled = !frameElement.dispatchEvent(newEvent); + + if (cancelled) { event.preventDefault(); - const _value = { ...value - }; - _value.formats = removeEditorOnlyFormats(value); - const canSplit = onReplace && onSplit; - - if (onReplace) { - const transforms = Object(external_wp_blocks_["getBlockTransforms"])('from').filter(({ - type - }) => type === 'enter'); - const transformation = Object(external_wp_blocks_["findTransform"])(transforms, item => { - return item.regExp.test(_value.text); - }); - - if (transformation) { - onReplace([transformation.transform({ - content: _value.text - })]); - - __unstableMarkAutomaticChange(); - } - } - - if (multilineTag) { - if (event.shiftKey) { - if (!disableLineBreaks) { - onChange(Object(external_wp_richText_["insert"])(_value, '\n')); - } - } else if (canSplit && Object(external_wp_richText_["__unstableIsEmptyLine"])(_value)) { - splitValue({ - value: _value, - onReplace, - onSplit, - onSplitMiddle, - multilineTag - }); - } else { - onChange(Object(external_wp_richText_["__unstableInsertLineSeparator"])(_value)); - } - } else { - const { - text, - start, - end - } = _value; - const canSplitAtEnd = onSplitAtEnd && start === end && end === text.length; - - if (event.shiftKey || !canSplit && !canSplitAtEnd) { - if (!disableLineBreaks) { - onChange(Object(external_wp_richText_["insert"])(_value, '\n')); - } - } else if (!canSplit && canSplitAtEnd) { - onSplitAtEnd(); - } else if (canSplit) { - splitValue({ - value: _value, - onReplace, - onSplit, - onSplitMiddle, - multilineTag - }); - } - } - } - - element.addEventListener('keydown', onKeyDown); - return () => { - element.removeEventListener('keydown', onKeyDown); - }; - }, []); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-format-types.js -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - - -function formatTypesSelector(select) { - return select(external_wp_richText_["store"]).getFormatTypes(); -} -/** - * Set of all interactive content tags. - * - * @see https://html.spec.whatwg.org/multipage/dom.html#interactive-content - */ - - -const interactiveContentTags = new Set(['a', 'audio', 'button', 'details', 'embed', 'iframe', 'input', 'label', 'select', 'textarea', 'video']); -/** - * This hook provides RichText with the `formatTypes` and its derived props from - * experimental format type settings. - * - * @param {Object} $0 Options - * @param {string} $0.clientId Block client ID. - * @param {string} $0.identifier Block attribute. - * @param {boolean} $0.withoutInteractiveFormatting Whether to clean the interactive formattings or not. - * @param {Array} $0.allowedFormats Allowed formats - */ - -function useFormatTypes({ - clientId, - identifier, - withoutInteractiveFormatting, - allowedFormats -}) { - const allFormatTypes = Object(external_wp_data_["useSelect"])(formatTypesSelector, []); - const formatTypes = Object(external_wp_element_["useMemo"])(() => { - return allFormatTypes.filter(({ - name, - tagName - }) => { - if (allowedFormats && !allowedFormats.includes(name)) { + } + } + + const eventTypes = ['dragover']; + + for (const name of eventTypes) { + doc.addEventListener(name, bubbleEvent); + } +} + +function useParsedAssets(html) { + return (0,external_wp_element_namespaceObject.useMemo)(() => { + const doc = document.implementation.createHTMLDocument(''); + doc.body.innerHTML = html; + return Array.from(doc.body.children); + }, [html]); +} + +async function loadScript(head, _ref2) { + let { + id, + src + } = _ref2; + return new Promise((resolve, reject) => { + const script = head.ownerDocument.createElement('script'); + script.id = id; + + if (src) { + script.src = src; + + script.onload = () => resolve(); + + script.onerror = () => reject(); + } else { + resolve(); + } + + head.appendChild(script); + }); +} + +function Iframe(_ref3, ref) { + let { + contentRef, + children, + head, + tabIndex = 0, + assets, + ...props + } = _ref3; + const [, forceRender] = (0,external_wp_element_namespaceObject.useReducer)(() => ({})); + const [iframeDocument, setIframeDocument] = (0,external_wp_element_namespaceObject.useState)(); + const [bodyClasses, setBodyClasses] = (0,external_wp_element_namespaceObject.useState)([]); + const styles = useParsedAssets(assets === null || assets === void 0 ? void 0 : assets.styles); + const scripts = useParsedAssets(assets === null || assets === void 0 ? void 0 : assets.scripts); + const clearerRef = useBlockSelectionClearer(); + const [before, writingFlowRef, after] = useWritingFlow(); + const setRef = (0,external_wp_compose_namespaceObject.useRefEffect)(node => { + function setDocumentIfReady() { + const { + contentDocument, + ownerDocument + } = node; + const { + readyState, + documentElement + } = contentDocument; + + if (readyState !== 'interactive' && readyState !== 'complete') { return false; } - if (withoutInteractiveFormatting && interactiveContentTags.has(tagName)) { - return false; - } - + bubbleEvents(contentDocument); + setIframeDocument(contentDocument); + clearerRef(documentElement); // Ideally ALL classes that are added through get_body_class should + // be added in the editor too, which we'll somehow have to get from + // the server in the future (which will run the PHP filters). + + setBodyClasses(Array.from(ownerDocument.body.classList).filter(name => name.startsWith('admin-color-') || name.startsWith('post-type-') || name === 'wp-embed-responsive')); + contentDocument.dir = ownerDocument.dir; + documentElement.removeChild(contentDocument.head); + documentElement.removeChild(contentDocument.body); return true; - }); - }, [allFormatTypes, allowedFormats, interactiveContentTags]); - const keyedSelected = Object(external_wp_data_["useSelect"])(select => formatTypes.reduce((accumulator, type) => { - if (type.__experimentalGetPropsForEditableTreePreparation) { - accumulator[type.name] = type.__experimentalGetPropsForEditableTreePreparation(select, { - richTextIdentifier: identifier, - blockClientId: clientId - }); - } - - return accumulator; - }, {}), [formatTypes, clientId, identifier]); - const dispatch = Object(external_wp_data_["useDispatch"])(); - const prepareHandlers = []; - const valueHandlers = []; - const changeHandlers = []; - const dependencies = []; - formatTypes.forEach(type => { - if (type.__experimentalCreatePrepareEditableTree) { - const selected = keyedSelected[type.name]; - - const handler = type.__experimentalCreatePrepareEditableTree(selected, { - richTextIdentifier: identifier, - blockClientId: clientId - }); - - if (type.__experimentalCreateOnChangeEditableValue) { - valueHandlers.push(handler); - } else { - prepareHandlers.push(handler); - } - - for (const key in selected) { - dependencies.push(selected[key]); - } - } - - if (type.__experimentalCreateOnChangeEditableValue) { - let dispatchers = {}; - - if (type.__experimentalGetPropsForEditableTreeChangeHandler) { - dispatchers = type.__experimentalGetPropsForEditableTreeChangeHandler(dispatch, { - richTextIdentifier: identifier, - blockClientId: clientId - }); - } - - changeHandlers.push(type.__experimentalCreateOnChangeEditableValue({ ...(keyedSelected[type.name] || {}), - ...dispatchers - }, { - richTextIdentifier: identifier, - blockClientId: clientId - })); - } - }); - return { - formatTypes, - prepareHandlers, - valueHandlers, - changeHandlers, - dependencies - }; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-edit.js - - -/** - * WordPress dependencies - */ - -function FormatEdit({ - formatTypes, - onChange, - onFocus, - value, - forwardedRef -}) { - return formatTypes.map(settings => { - const { - name, - edit: Edit - } = settings; - - if (!Edit) { - return null; - } - - const activeFormat = Object(external_wp_richText_["getActiveFormat"])(value, name); - const isActive = activeFormat !== undefined; - const activeObject = Object(external_wp_richText_["getActiveObject"])(value); - const isObjectActive = activeObject !== undefined && activeObject.type === name; - return Object(external_wp_element_["createElement"])(Edit, { - key: name, - isActive: isActive, - activeAttributes: isActive ? activeFormat.attributes || {} : {}, - isObjectActive: isObjectActive, - activeObjectAttributes: isObjectActive ? activeObject.attributes || {} : {}, - value: value, - onChange: onChange, - onFocus: onFocus, - contentRef: forwardedRef - }); - }); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/index.js - - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - - - - - -/** - * Internal dependencies - */ - - - - - - - - - - - - - - - -/** - * Removes props used for the native version of RichText so that they are not - * passed to the DOM element and log warnings. - * - * @param {Object} props Props to filter. - * - * @return {Object} Filtered props. - */ - -function removeNativeProps(props) { - return Object(external_lodash_["omit"])(props, ['__unstableMobileNoFocusOnMount', 'deleteEnter', 'placeholderTextColor', 'textAlign', 'selectionColor', 'tagsToEliminate', 'rootTagsToEliminate', 'disableEditingMenu', 'fontSize', 'fontFamily', 'fontWeight', 'fontStyle', 'minWidth', 'maxWidth', 'setRef']); -} - -function RichTextWrapper({ - children, - tagName = 'div', - value: originalValue = '', - onChange: originalOnChange, - isSelected: originalIsSelected, - multiline, - inlineToolbar, - wrapperClassName, - autocompleters, - onReplace, - placeholder, - allowedFormats, - formattingControls, - withoutInteractiveFormatting, - onRemove, - onMerge, - onSplit, - __unstableOnSplitAtEnd: onSplitAtEnd, - __unstableOnSplitMiddle: onSplitMiddle, - identifier, - preserveWhiteSpace, - __unstablePastePlainText: pastePlainText, - __unstableEmbedURLOnPaste, - __unstableDisableFormats: disableFormats, - disableLineBreaks, - unstableOnFocus, - __unstableAllowPrefixTransformations, - ...props -}, forwardedRef) { - const instanceId = Object(external_wp_compose_["useInstanceId"])(RichTextWrapper); - identifier = identifier || instanceId; - props = removeNativeProps(props); - const anchorRef = Object(external_wp_element_["useRef"])(); - const { - clientId - } = useBlockEditContext(); - - const selector = select => { - const { - getSelectionStart, - getSelectionEnd, - isMultiSelecting, - hasMultiSelection - } = select(store); - const selectionStart = getSelectionStart(); - const selectionEnd = getSelectionEnd(); - let isSelected; - - if (originalIsSelected === undefined) { - isSelected = selectionStart.clientId === clientId && selectionStart.attributeKey === identifier; - } else if (originalIsSelected) { - isSelected = selectionStart.clientId === clientId; - } - - return { - selectionStart: isSelected ? selectionStart.offset : undefined, - selectionEnd: isSelected ? selectionEnd.offset : undefined, - isSelected, - disabled: isMultiSelecting() || hasMultiSelection() - }; - }; // This selector must run on every render so the right selection state is - // retreived from the store on merge. - // To do: fix this somehow. - - - const { - selectionStart, - selectionEnd, - isSelected, - disabled - } = Object(external_wp_data_["useSelect"])(selector); - const { - selectionChange - } = Object(external_wp_data_["useDispatch"])(store); - const multilineTag = getMultilineTag(multiline); - const adjustedAllowedFormats = getAllowedFormats({ - allowedFormats, - formattingControls, - disableFormats - }); - const hasFormats = !adjustedAllowedFormats || adjustedAllowedFormats.length > 0; - let adjustedValue = originalValue; - let adjustedOnChange = originalOnChange; // Handle deprecated format. - - if (Array.isArray(originalValue)) { - adjustedValue = external_wp_blocks_["children"].toHTML(originalValue); - - adjustedOnChange = newValue => originalOnChange(external_wp_blocks_["children"].fromDOM(Object(external_wp_richText_["__unstableCreateElement"])(document, newValue).childNodes)); - } - - const onSelectionChange = Object(external_wp_element_["useCallback"])((start, end) => { - selectionChange(clientId, identifier, start, end); - }, [clientId, identifier]); - const { - formatTypes, - prepareHandlers, - valueHandlers, - changeHandlers, - dependencies - } = useFormatTypes({ - clientId, - identifier, - withoutInteractiveFormatting, - allowedFormats: adjustedAllowedFormats - }); - - function addEditorOnlyFormats(value) { - return valueHandlers.reduce((accumulator, fn) => fn(accumulator, value.text), value.formats); - } - - function removeEditorOnlyFormats(value) { - formatTypes.forEach(formatType => { - // Remove formats created by prepareEditableTree, because they are editor only. - if (formatType.__experimentalCreatePrepareEditableTree) { - value = Object(external_wp_richText_["removeFormat"])(value, formatType.name, 0, value.text.length); - } - }); - return value.formats; - } - - function addInvisibleFormats(value) { - return prepareHandlers.reduce((accumulator, fn) => fn(accumulator, value.text), value.formats); - } - - const { - value, - onChange, - onFocus, - ref: richTextRef - } = Object(external_wp_richText_["__unstableUseRichText"])({ - value: adjustedValue, - - onChange(html, { - __unstableFormats, - __unstableText - }) { - adjustedOnChange(html); - Object.values(changeHandlers).forEach(changeHandler => { - changeHandler(__unstableFormats, __unstableText); - }); - }, - - selectionStart, - selectionEnd, - onSelectionChange, - placeholder, - __unstableIsSelected: isSelected, - __unstableMultilineTag: multilineTag, - __unstableDisableFormats: disableFormats, - preserveWhiteSpace, - __unstableDependencies: [...dependencies, tagName], - __unstableAfterParse: addEditorOnlyFormats, - __unstableBeforeSerialize: removeEditorOnlyFormats, - __unstableAddInvisibleFormats: addInvisibleFormats - }); - const autocompleteProps = useBlockEditorAutocompleteProps({ - onReplace, - completers: autocompleters, - record: value, - onChange - }); - useCaretInFormat({ - value - }); - useMarkPersistent({ - html: adjustedValue, - value - }); - - function onKeyDown(event) { - const { - keyCode - } = event; - - if (event.defaultPrevented) { - return; - } - - if (keyCode === external_wp_keycodes_["DELETE"] || keyCode === external_wp_keycodes_["BACKSPACE"]) { - const { - start, - end, - text - } = value; - const isReverse = keyCode === external_wp_keycodes_["BACKSPACE"]; - const hasActiveFormats = value.activeFormats && !!value.activeFormats.length; // Only process delete if the key press occurs at an uncollapsed edge. - - if (!Object(external_wp_richText_["isCollapsed"])(value) || hasActiveFormats || isReverse && start !== 0 || !isReverse && end !== text.length) { - 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 && Object(external_wp_richText_["isEmpty"])(value) && isReverse) { - onRemove(!isReverse); - } - - event.preventDefault(); - } - } - - const TagName = tagName; - const content = Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, isSelected && children && children({ - value, - onChange, - onFocus - }), isSelected && Object(external_wp_element_["createElement"])(RemoveBrowserShortcuts, null), isSelected && Object(external_wp_element_["createElement"])(FormatEdit, { - value: value, - onChange: onChange, - onFocus: onFocus, - formatTypes: formatTypes, - forwardedRef: anchorRef - }), isSelected && hasFormats && Object(external_wp_element_["createElement"])(format_toolbar_container, { - inline: inlineToolbar, - anchorRef: anchorRef.current - }), Object(external_wp_element_["createElement"])(TagName // Overridable props. - , Object(esm_extends["a" /* default */])({ - role: "textbox", - "aria-multiline": true, - "aria-label": placeholder - }, props, autocompleteProps, { - ref: Object(external_wp_compose_["useMergeRefs"])([autocompleteProps.ref, props.ref, richTextRef, useInputRules({ - value, - onChange, - __unstableAllowPrefixTransformations, - formatTypes, - onReplace - }), useUndoAutomaticChange(), usePasteHandler({ - isSelected, - disableFormats, - onChange, - value, - formatTypes, + } // Document set with srcDoc is not immediately ready. + + + node.addEventListener('load', setDocumentIfReady); + return () => node.removeEventListener('load', setDocumentIfReady); + }, []); + const headRef = (0,external_wp_compose_namespaceObject.useRefEffect)(element => { + scripts.reduce((promise, script) => promise.then(() => loadScript(element, script)), Promise.resolve()).finally(() => { + // When script are loaded, re-render blocks to allow them + // to initialise. + forceRender(); + }); + }, []); + const bodyRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([contentRef, clearerRef, writingFlowRef]); + const styleCompatibilityRef = useStylesCompatibility(); + head = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("style", null, 'body{margin:0}'), styles.map(_ref4 => { + let { tagName, - onReplace, - onSplit, - onSplitMiddle, - __unstableEmbedURLOnPaste, - multilineTag, - preserveWhiteSpace, - pastePlainText - }), useEnter({ - removeEditorOnlyFormats, - value, - onReplace, - onSplit, - onSplitMiddle, - multilineTag, - onChange, - disableLineBreaks, - onSplitAtEnd - }), anchorRef, forwardedRef]) // Do not set the attribute if disabled. + href, + id, + rel, + media, + textContent + } = _ref4; + const TagName = tagName.toLowerCase(); + + if (TagName === 'style') { + return (0,external_wp_element_namespaceObject.createElement)(TagName, { + id, + key: id + }, textContent); + } + + return (0,external_wp_element_namespaceObject.createElement)(TagName, { + href, + id, + rel, + media, + key: id + }); + }), head); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, tabIndex >= 0 && before, (0,external_wp_element_namespaceObject.createElement)("iframe", _extends({}, props, { + ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, setRef]), + tabIndex: tabIndex // Correct doctype is required to enable rendering in standards mode , - contentEditable: disabled ? undefined : true, - suppressContentEditableWarning: !disabled, - className: classnames_default()('block-editor-rich-text__editable', props.className, 'rich-text'), - onFocus: unstableOnFocus, - onKeyDown: onKeyDown - }))); - - if (!wrapperClassName) { - return content; - } - - external_wp_deprecated_default()('wp.blockEditor.RichText wrapperClassName prop', { - since: '5.4', - alternative: 'className prop or create your own wrapper div' - }); - const className = classnames_default()('block-editor-rich-text', wrapperClassName); - return Object(external_wp_element_["createElement"])("div", { - className: className - }, content); -} - -const ForwardedRichTextContainer = Object(external_wp_element_["forwardRef"])(RichTextWrapper); - -ForwardedRichTextContainer.Content = ({ - value, - tagName: Tag, - multiline, - ...props -}) => { - // Handle deprecated `children` and `node` sources. - if (Array.isArray(value)) { - value = external_wp_blocks_["children"].toHTML(value); - } - - const MultilineTag = getMultilineTag(multiline); - - if (!value && MultilineTag) { - value = `<${MultilineTag}>`; - } - - const content = Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, value); - - if (Tag) { - return Object(external_wp_element_["createElement"])(Tag, Object(external_lodash_["omit"])(props, ['format']), content); - } - - return content; -}; - -ForwardedRichTextContainer.isEmpty = value => { - return !value || value.length === 0; -}; -/** - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md - */ - - -/* harmony default export */ var rich_text = (ForwardedRichTextContainer); - - - - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/editor.js - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - - -function BlockNavigationEditor({ - value, - onChange -}) { - return Object(external_wp_element_["createElement"])(BlockNavigationBlockFill, null, Object(external_wp_element_["createElement"])(rich_text, { - value: value, - onChange: onChange, - placeholder: Object(external_wp_i18n_["__"])('Navigation item'), - withoutInteractiveFormatting: true, - allowedFormats: ['core/bold', 'core/italic', 'core/image', 'core/strikethrough'] - })); -} - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js -var library_layout = __webpack_require__("Civd"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-variation-picker/index.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - -function BlockVariationPicker({ - icon = library_layout["a" /* default */], - label = Object(external_wp_i18n_["__"])('Choose variation'), - instructions = Object(external_wp_i18n_["__"])('Select a variation to start with.'), - variations, - onSelect, - allowSkip -}) { - const classes = classnames_default()('block-editor-block-variation-picker', { - 'has-many-variations': variations.length > 4 - }); - return Object(external_wp_element_["createElement"])(external_wp_components_["Placeholder"], { - icon: icon, - label: label, - instructions: instructions, - className: classes - }, Object(external_wp_element_["createElement"])("ul", { - className: "block-editor-block-variation-picker__variations", - role: "list", - "aria-label": Object(external_wp_i18n_["__"])('Block variations') - }, variations.map(variation => Object(external_wp_element_["createElement"])("li", { - key: variation.name - }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - isSecondary: true, - icon: variation.icon, - iconSize: 48, - onClick: () => onSelect(variation), - className: "block-editor-block-variation-picker__variation", - label: variation.description || variation.title - }), Object(external_wp_element_["createElement"])("span", { - className: "block-editor-block-variation-picker__variation-label", - role: "presentation" - }, variation.title)))), allowSkip && Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-variation-picker__skip" - }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - isLink: true, - onClick: () => onSelect() - }, Object(external_wp_i18n_["__"])('Skip')))); -} - -/* harmony default export */ var block_variation_picker = (BlockVariationPicker); - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/grid.js -var grid = __webpack_require__("b2RC"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/constants.js -const VIEWMODES = { - carousel: 'carousel', - grid: 'grid' -}; - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/setup-toolbar.js - - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - -const Actions = ({ - onStartBlank, - onBlockPatternSelect -}) => Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-pattern-setup__actions" -}, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - onClick: onStartBlank -}, Object(external_wp_i18n_["__"])('Start blank')), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - isPrimary: true, - onClick: onBlockPatternSelect -}, Object(external_wp_i18n_["__"])('Choose'))); - -const CarouselNavigation = ({ - handlePrevious, - handleNext, - activeSlide, - totalSlides -}) => Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-pattern-setup__navigation" -}, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - icon: chevron_left["a" /* default */], - label: Object(external_wp_i18n_["__"])('Previous pattern'), - onClick: handlePrevious, - disabled: activeSlide === 0 -}), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - icon: chevron_right["a" /* default */], - label: Object(external_wp_i18n_["__"])('Next pattern'), - onClick: handleNext, - disabled: activeSlide === totalSlides - 1 -})); - -const SetupToolbar = ({ - viewMode, - setViewMode, - handlePrevious, - handleNext, - activeSlide, - totalSlides, - onBlockPatternSelect, - onStartBlank -}) => { - const isCarouselView = viewMode === VIEWMODES.carousel; - const displayControls = Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-pattern-setup__display-controls" - }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - icon: stretch_full_width, - label: Object(external_wp_i18n_["__"])('Carousel view'), - onClick: () => setViewMode(VIEWMODES.carousel), - isPressed: isCarouselView - }), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - icon: grid["a" /* default */], - label: Object(external_wp_i18n_["__"])('Grid view'), - onClick: () => setViewMode(VIEWMODES.grid), - isPressed: viewMode === VIEWMODES.grid - })); - return Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-pattern-setup__toolbar" - }, isCarouselView && Object(external_wp_element_["createElement"])(CarouselNavigation, { - handlePrevious: handlePrevious, - handleNext: handleNext, - activeSlide: activeSlide, - totalSlides: totalSlides - }), displayControls, isCarouselView && Object(external_wp_element_["createElement"])(Actions, { - onBlockPatternSelect: onBlockPatternSelect, - onStartBlank: onStartBlank - })); -}; - -/* harmony default export */ var setup_toolbar = (SetupToolbar); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/use-patterns-setup.js -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - - -function usePatternsSetup(clientId, blockName, filterPatternsFn) { - return Object(external_wp_data_["useSelect"])(select => { - const { - getBlockRootClientId, - __experimentalGetPatternsByBlockTypes, - __experimentalGetAllowedPatterns - } = select(store); - const rootClientId = getBlockRootClientId(clientId); - - if (filterPatternsFn) { - return __experimentalGetAllowedPatterns(rootClientId).filter(filterPatternsFn); - } - - return __experimentalGetPatternsByBlockTypes(blockName, rootClientId); - }, [clientId, blockName, filterPatternsFn]); -} - -/* harmony default export */ var use_patterns_setup = (usePatternsSetup); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/index.js - - - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - - - - - -const SetupContent = ({ - viewMode, - activeSlide, - patterns, - onBlockPatternSelect -}) => { - const composite = Object(external_wp_components_["__unstableUseCompositeState"])(); - const containerClass = 'block-editor-block-pattern-setup__container'; - - if (viewMode === VIEWMODES.carousel) { - const slideClass = new Map([[activeSlide, 'active-slide'], [activeSlide - 1, 'previous-slide'], [activeSlide + 1, 'next-slide']]); - return Object(external_wp_element_["createElement"])("div", { - className: containerClass - }, Object(external_wp_element_["createElement"])("ul", { - className: "carousel-container" - }, patterns.map((pattern, index) => Object(external_wp_element_["createElement"])(BlockPatternSlide, { - className: slideClass.get(index) || '', - key: pattern.name, - pattern: pattern - })))); - } - - return Object(external_wp_element_["createElement"])(external_wp_components_["__unstableComposite"], Object(esm_extends["a" /* default */])({}, composite, { - role: "listbox", - className: containerClass, - "aria-label": Object(external_wp_i18n_["__"])('Patterns list') - }), patterns.map(pattern => Object(external_wp_element_["createElement"])(block_pattern_setup_BlockPattern, { - key: pattern.name, - pattern: pattern, - onSelect: onBlockPatternSelect, - composite: composite - }))); -}; - -function block_pattern_setup_BlockPattern({ - pattern, - onSelect, - composite -}) { - const baseClassName = 'block-editor-block-pattern-setup-list'; - const { - blocks, - title, - description, - viewportWidth = 700 - } = pattern; - const descriptionId = Object(external_wp_compose_["useInstanceId"])(block_pattern_setup_BlockPattern, `${baseClassName}__item-description`); - return Object(external_wp_element_["createElement"])("div", { - className: `${baseClassName}__list-item`, - "aria-label": pattern.title, - "aria-describedby": pattern.description ? descriptionId : undefined - }, Object(external_wp_element_["createElement"])(external_wp_components_["__unstableCompositeItem"], Object(esm_extends["a" /* default */])({ - role: "option", - as: "div" - }, composite, { - className: `${baseClassName}__item`, - onClick: () => onSelect(blocks) - }), Object(external_wp_element_["createElement"])(block_preview, { - blocks: blocks, - viewportWidth: viewportWidth - }), Object(external_wp_element_["createElement"])("div", { - className: `${baseClassName}__item-title` - }, title)), !!description && Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { - id: descriptionId - }, description)); -} - -function BlockPatternSlide({ - className, - pattern -}) { - const { - blocks, - title, - description - } = pattern; - const descriptionId = Object(external_wp_compose_["useInstanceId"])(BlockPatternSlide, 'block-editor-block-pattern-setup-list__item-description'); - return Object(external_wp_element_["createElement"])("li", { - className: `pattern-slide ${className}`, - "aria-label": title, - "aria-describedby": description ? descriptionId : undefined - }, Object(external_wp_element_["createElement"])(block_preview, { - blocks: blocks, - __experimentalLive: true - }), !!description && Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { - id: descriptionId - }, description)); -} - -const BlockPatternSetup = ({ - clientId, - blockName, - filterPatternsFn, - startBlankComponent, - onBlockPatternSelect -}) => { - const [viewMode, setViewMode] = Object(external_wp_element_["useState"])(VIEWMODES.carousel); - const [activeSlide, setActiveSlide] = Object(external_wp_element_["useState"])(0); - const [showBlank, setShowBlank] = Object(external_wp_element_["useState"])(false); - const { - replaceBlock - } = Object(external_wp_data_["useDispatch"])(store); - const patterns = use_patterns_setup(clientId, blockName, filterPatternsFn); - - if (!(patterns !== null && patterns !== void 0 && patterns.length) || showBlank) { - return startBlankComponent; - } - - const onBlockPatternSelectDefault = blocks => { - const clonedBlocks = blocks.map(block => Object(external_wp_blocks_["cloneBlock"])(block)); - replaceBlock(clientId, clonedBlocks); - }; - - const onPatternSelectCallback = onBlockPatternSelect || onBlockPatternSelectDefault; - return Object(external_wp_element_["createElement"])("div", { - className: `block-editor-block-pattern-setup view-mode-${viewMode}` - }, Object(external_wp_element_["createElement"])(setup_toolbar, { - viewMode: viewMode, - setViewMode: setViewMode, - activeSlide: activeSlide, - totalSlides: patterns.length, - handleNext: () => { - setActiveSlide(active => active + 1); - }, - handlePrevious: () => { - setActiveSlide(active => active - 1); - }, - onBlockPatternSelect: () => { - onPatternSelectCallback(patterns[activeSlide].blocks); - }, - onStartBlank: () => { - setShowBlank(true); - } - }), Object(external_wp_element_["createElement"])(SetupContent, { - viewMode: viewMode, - activeSlide: activeSlide, - patterns: patterns, - onBlockPatternSelect: onPatternSelectCallback - })); -}; - -/* harmony default export */ var block_pattern_setup = (BlockPatternSetup); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/block-variation-transforms.js -/** - * External dependencies - */ - -/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */ - -/** - * Matches the provided block variations with a block's attributes. If no match - * or more than one matches are found it returns `undefined`. If a single match is - * found it returns it. - * - * This is a simple implementation for now as it takes into account only the attributes - * of a block variation and not `InnerBlocks`. - * - * @param {Object} blockAttributes - The block attributes to try to find a match. - * @param {WPBlockVariation[]} variations - A list of block variations to test for a match. - * @return {?WPBlockVariation} - If a match is found returns it. If not or more than one matches are found returns `undefined`. - */ - -const __experimentalGetMatchingVariation = (blockAttributes, variations) => { - if (!variations || !blockAttributes) return; - const matches = variations.filter(({ - attributes - }) => { - if (!attributes || !Object.keys(attributes).length) return false; - return Object(external_lodash_["isMatch"])(blockAttributes, attributes); - }); - if (matches.length !== 1) return; - return matches[0]; -}; - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-variation-transforms/index.js - - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - - -function __experimentalBlockVariationTransforms({ - blockClientId -}) { - const [selectedValue, setSelectedValue] = Object(external_wp_element_["useState"])(); - const { - updateBlockAttributes - } = Object(external_wp_data_["useDispatch"])(store); - const { - variations, - blockAttributes - } = Object(external_wp_data_["useSelect"])(select => { - const { - getBlockVariations - } = select(external_wp_blocks_["store"]); - const { - getBlockName, - getBlockAttributes - } = select(store); - const blockName = blockClientId && getBlockName(blockClientId); - return { - variations: blockName && getBlockVariations(blockName, 'transform'), - blockAttributes: getBlockAttributes(blockClientId) - }; - }, [blockClientId]); - Object(external_wp_element_["useEffect"])(() => { - var _getMatchingVariation; - - setSelectedValue((_getMatchingVariation = __experimentalGetMatchingVariation(blockAttributes, variations)) === null || _getMatchingVariation === void 0 ? void 0 : _getMatchingVariation.name); - }, [blockAttributes, variations]); - if (!(variations !== null && variations !== void 0 && variations.length)) return null; - const selectOptions = variations.map(({ - name, - title, - description - }) => ({ - value: name, - label: title, - info: description - })); - - const onSelectVariation = variationName => { - updateBlockAttributes(blockClientId, { ...variations.find(({ - name - }) => name === variationName).attributes - }); - }; - - const baseClass = 'block-editor-block-variation-transforms'; - return Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], { - className: baseClass, - label: Object(external_wp_i18n_["__"])('Transform to variation'), - text: Object(external_wp_i18n_["__"])('Transform to variation'), - popoverProps: { - position: 'bottom center', - className: `${baseClass}__popover` - }, - icon: chevron_down["a" /* default */], - toggleProps: { - iconPosition: 'right' - } - }, () => Object(external_wp_element_["createElement"])("div", { - className: `${baseClass}__container` - }, Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["MenuItemsChoice"], { - choices: selectOptions, - value: selectedValue, - onSelect: onSelectVariation - })))); -} - -/* harmony default export */ var block_variation_transforms = (__experimentalBlockVariationTransforms); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/icons.js - - -/** - * WordPress dependencies - */ - -const alignBottom = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { - d: "M15 4H9v11h6V4zM4 18.5V20h16v-1.5H4z" -})); -const alignCenter = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { - d: "M20 11h-5V4H9v7H4v1.5h5V20h6v-7.5h5z" -})); -const alignTop = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { - d: "M9 20h6V9H9v11zM4 4v1.5h16V4H4z" -})); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/ui.js - - - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -const ui_BLOCK_ALIGNMENTS_CONTROLS = { - top: { - icon: alignTop, - title: Object(external_wp_i18n_["_x"])('Align top', 'Block vertical alignment setting') - }, - center: { - icon: alignCenter, - title: Object(external_wp_i18n_["_x"])('Align middle', 'Block vertical alignment setting') - }, - bottom: { - icon: alignBottom, - title: Object(external_wp_i18n_["_x"])('Align bottom', 'Block vertical alignment setting') - } -}; -const ui_DEFAULT_CONTROLS = ['top', 'center', 'bottom']; -const ui_DEFAULT_CONTROL = 'top'; -const block_vertical_alignment_control_ui_POPOVER_PROPS = { - isAlternate: true -}; - -function BlockVerticalAlignmentUI({ - value, - onChange, - controls = ui_DEFAULT_CONTROLS, - isCollapsed = true, - isToolbar -}) { - function applyOrUnset(align) { - return () => onChange(value === align ? undefined : align); - } - - const activeAlignment = ui_BLOCK_ALIGNMENTS_CONTROLS[value]; - const defaultAlignmentControl = ui_BLOCK_ALIGNMENTS_CONTROLS[ui_DEFAULT_CONTROL]; - const UIComponent = isToolbar ? external_wp_components_["ToolbarGroup"] : external_wp_components_["ToolbarDropdownMenu"]; - const extraProps = isToolbar ? { - isCollapsed - } : {}; - return Object(external_wp_element_["createElement"])(UIComponent, Object(esm_extends["a" /* default */])({ - popoverProps: block_vertical_alignment_control_ui_POPOVER_PROPS, - icon: activeAlignment ? activeAlignment.icon : defaultAlignmentControl.icon, - label: Object(external_wp_i18n_["_x"])('Change vertical alignment', 'Block vertical alignment setting label'), - controls: controls.map(control => { - return { ...ui_BLOCK_ALIGNMENTS_CONTROLS[control], - isActive: value === control, - role: isCollapsed ? 'menuitemradio' : undefined, - onClick: applyOrUnset(control) - }; - }) - }, extraProps)); -} -/** - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-vertical-alignment-toolbar/README.md - */ - - -/* harmony default export */ var block_vertical_alignment_control_ui = (BlockVerticalAlignmentUI); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/index.js - - - -/** - * Internal dependencies - */ - -function BlockVerticalAlignmentControl(props) { - return Object(external_wp_element_["createElement"])(block_vertical_alignment_control_ui, Object(esm_extends["a" /* default */])({}, props, { - isToolbar: false - })); -} -function BlockVerticalAlignmentToolbar(props) { - return Object(external_wp_element_["createElement"])(block_vertical_alignment_control_ui, Object(esm_extends["a" /* default */])({}, props, { - isToolbar: true - })); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-palette/with-color-context.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -/* harmony default export */ var with_color_context = (Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => { - return props => { - const colorsFeature = useSetting('color.palette'); - const disableCustomColorsFeature = !useSetting('color.custom'); - const colors = props.colors === undefined ? colorsFeature : props.colors; - const disableCustomColors = props.disableCustomColors === undefined ? disableCustomColorsFeature : props.disableCustomColors; - const hasColorsToChoose = !Object(external_lodash_["isEmpty"])(colors) || !disableCustomColors; - return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, props, { - colors, - disableCustomColors, - hasColorsToChoose - })); - }; -}, 'withColorContext')); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-palette/index.js -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - -/* harmony default export */ var color_palette = (with_color_context(external_wp_components_["ColorPalette"])); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-palette/control.js - - - -/** - * Internal dependencies - */ - -function ColorPaletteControl({ - onChange, - value, - ...otherProps -}) { - return Object(external_wp_element_["createElement"])(control, Object(esm_extends["a" /* default */])({}, otherProps, { - onColorChange: onChange, - colorValue: value, - gradients: [], - disableCustomGradients: true - })); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/gradient-picker/index.js - - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - -const gradient_picker_EMPTY_ARRAY = []; - -function GradientPickerWithGradients(props) { - const gradients = useSetting('color.gradients') || gradient_picker_EMPTY_ARRAY; - const disableCustomGradients = !useSetting('color.customGradient'); - return Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalGradientPicker"], Object(esm_extends["a" /* default */])({ - gradients: props.gradients !== undefined ? props.gradient : gradients, - disableCustomGradients: props.disableCustomGradients !== undefined ? props.disableCustomGradients : disableCustomGradients - }, props)); -} - -/* harmony default export */ var gradient_picker = (function (props) { - const ComponentToUse = props.gradients !== undefined && props.disableCustomGradients !== undefined ? external_wp_components_["__experimentalGradientPicker"] : GradientPickerWithGradients; - return Object(external_wp_element_["createElement"])(ComponentToUse, props); -}); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/gradient-picker/control.js - - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - -function GradientPickerControl({ - className, - value, - onChange, - label = Object(external_wp_i18n_["__"])('Gradient Presets'), - ...props -}) { - const gradients = useSetting('color.gradients'); - const disableCustomGradients = !useSetting('color.customGradient'); - - if (Object(external_lodash_["isEmpty"])(gradients) && disableCustomGradients) { - return null; - } - - return Object(external_wp_element_["createElement"])(external_wp_components_["BaseControl"], { - className: classnames_default()('block-editor-gradient-picker-control', className) - }, Object(external_wp_element_["createElement"])(external_wp_components_["BaseControl"].VisualLabel, null, label), Object(external_wp_element_["createElement"])(gradient_picker, Object(esm_extends["a" /* default */])({ - value: value, - onChange: onChange, - className: "block-editor-gradient-picker-control__gradient-picker-presets", - gradients: gradients, - disableCustomGradients: disableCustomGradients - }, props))); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/gradient-picker/panel.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - -function GradientPanel(props) { - const gradients = useSetting('color.gradients'); - - if (Object(external_lodash_["isEmpty"])(gradients)) { - return null; - } - - return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { - title: Object(external_wp_i18n_["__"])('Gradient') - }, Object(external_wp_element_["createElement"])(GradientPickerControl, props)); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-size-control/index.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - -const IMAGE_SIZE_PRESETS = [25, 50, 75, 100]; -function ImageSizeControl({ - imageWidth, - imageHeight, - imageSizeOptions = [], - isResizable = true, - slug, - width, - height, - onChange, - onChangeImage = external_lodash_["noop"] -}) { - var _ref, _ref2; - - function updateDimensions(nextWidth, nextHeight) { - return () => { - onChange({ - width: nextWidth, - height: nextHeight - }); - }; - } - - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, !Object(external_lodash_["isEmpty"])(imageSizeOptions) && Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], { - label: Object(external_wp_i18n_["__"])('Image size'), - value: slug, - options: imageSizeOptions, - onChange: onChangeImage - }), isResizable && Object(external_wp_element_["createElement"])("div", { - className: "block-editor-image-size-control" - }, Object(external_wp_element_["createElement"])("p", { - className: "block-editor-image-size-control__row" - }, Object(external_wp_i18n_["__"])('Image dimensions')), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-image-size-control__row" - }, Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { - type: "number", - className: "block-editor-image-size-control__width", - label: Object(external_wp_i18n_["__"])('Width'), - value: (_ref = width !== null && width !== void 0 ? width : imageWidth) !== null && _ref !== void 0 ? _ref : '', - min: 1, - onChange: value => onChange({ - width: parseInt(value, 10) - }) - }), Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { - type: "number", - className: "block-editor-image-size-control__height", - label: Object(external_wp_i18n_["__"])('Height'), - value: (_ref2 = height !== null && height !== void 0 ? height : imageHeight) !== null && _ref2 !== void 0 ? _ref2 : '', - min: 1, - onChange: value => onChange({ - height: parseInt(value, 10) - }) - })), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-image-size-control__row" - }, Object(external_wp_element_["createElement"])(external_wp_components_["ButtonGroup"], { - "aria-label": Object(external_wp_i18n_["__"])('Image size presets') - }, IMAGE_SIZE_PRESETS.map(scale => { - const scaledWidth = Math.round(imageWidth * (scale / 100)); - const scaledHeight = Math.round(imageHeight * (scale / 100)); - const isCurrent = width === scaledWidth && height === scaledHeight; - return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - key: scale, - isSmall: true, - isPrimary: isCurrent, - isPressed: isCurrent, - onClick: updateDimensions(scaledWidth, scaledHeight) - }, scale, "%"); - })), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - isSmall: true, - onClick: updateDimensions() - }, Object(external_wp_i18n_["__"])('Reset'))))); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/with-client-id.js - - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - -const withClientId = Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => props => { - const { - clientId - } = useBlockEditContext(); - return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, props, { - clientId: clientId - })); -}, 'withClientId'); -/* harmony default export */ var with_client_id = (withClientId); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/button-block-appender.js - - -/** - * Internal dependencies - */ - - -const button_block_appender_ButtonBlockAppender = ({ - clientId, - showSeparator, - isFloating, - onAddBlock -}) => { - return Object(external_wp_element_["createElement"])(button_block_appender, { - rootClientId: clientId, - showSeparator: showSeparator, - isFloating: isFloating, - onAddBlock: onAddBlock - }); -}; -/* harmony default export */ var inner_blocks_button_block_appender = (with_client_id(button_block_appender_ButtonBlockAppender)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/default-block-appender.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - - -const default_block_appender_DefaultBlockAppender = ({ - clientId, - lastBlockClientId -}) => { - return Object(external_wp_element_["createElement"])(default_block_appender, { - rootClientId: clientId, - lastBlockClientId: lastBlockClientId - }); -}; -/* harmony default export */ var inner_blocks_default_block_appender = (Object(external_wp_compose_["compose"])([with_client_id, Object(external_wp_data_["withSelect"])((select, { - clientId -}) => { - const { - getBlockOrder - } = select(store); - const blockClientIds = getBlockOrder(clientId); - return { - lastBlockClientId: Object(external_lodash_["last"])(blockClientIds) - }; -})])(default_block_appender_DefaultBlockAppender)); - -// EXTERNAL MODULE: external ["wp","isShallowEqual"] -var external_wp_isShallowEqual_ = __webpack_require__("rl8x"); -var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-nested-settings-update.js -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - -/** - * This hook is a side effect which updates the block-editor store when changes - * happen to inner block settings. The given props are transformed into a - * settings object, and if that is different from the current settings object in - * the block-editor store, then the store is updated with the new settings which - * came from props. - * - * @param {string} clientId The client ID of the block to update. - * @param {string[]} allowedBlocks An array of block names which are permitted - * in inner blocks. - * @param {string} [templateLock] The template lock specified for the inner - * blocks component. (e.g. "all") - * @param {boolean} captureToolbars Whether or children toolbars should be shown - * in the inner blocks component rather than on - * the child block. - * @param {string} orientation The direction in which the block - * should face. - */ - -function useNestedSettingsUpdate(clientId, allowedBlocks, templateLock, captureToolbars, orientation) { - const { - updateBlockListSettings - } = Object(external_wp_data_["useDispatch"])(store); - const { - blockListSettings, - parentLock - } = Object(external_wp_data_["useSelect"])(select => { - const rootClientId = select(store).getBlockRootClientId(clientId); - return { - blockListSettings: select(store).getBlockListSettings(clientId), - parentLock: select(store).getTemplateLock(rootClientId) - }; - }, [clientId]); // Memoize as inner blocks implementors often pass a new array on every - // render. - - const _allowedBlocks = Object(external_wp_element_["useMemo"])(() => allowedBlocks, allowedBlocks); - - Object(external_wp_element_["useLayoutEffect"])(() => { - const newSettings = { - allowedBlocks: _allowedBlocks, - templateLock: templateLock === undefined ? parentLock : templateLock - }; // These values are not defined for RN, so only include them if they - // are defined. - - if (captureToolbars !== undefined) { - newSettings.__experimentalCaptureToolbars = captureToolbars; - } - - if (orientation !== undefined) { - newSettings.orientation = orientation; - } - - if (!external_wp_isShallowEqual_default()(blockListSettings, newSettings)) { - updateBlockListSettings(clientId, newSettings); - } - }, [clientId, blockListSettings, _allowedBlocks, templateLock, parentLock, captureToolbars, orientation, updateBlockListSettings]); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-inner-block-template-sync.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - -/** - * This hook makes sure that a block's inner blocks stay in sync with the given - * block "template". The template is a block hierarchy to which inner blocks must - * conform. If the blocks get "out of sync" with the template and the template - * is meant to be locked (e.g. templateLock = "all"), then we replace the inner - * blocks with the correct value after synchronizing it with the template. - * - * @param {string} clientId The block client ID. - * @param {Object} template The template to match. - * @param {string} templateLock The template lock state for the inner blocks. For - * example, if the template lock is set to "all", - * then the inner blocks will stay in sync with the - * template. If not defined or set to false, then - * the inner blocks will not be synchronized with - * the given template. - * @param {boolean} templateInsertUpdatesSelection Whether or not to update the - * block-editor selection state when inner blocks - * are replaced after template synchronization. - */ - -function useInnerBlockTemplateSync(clientId, template, templateLock, templateInsertUpdatesSelection) { - const { - getSelectedBlocksInitialCaretPosition - } = Object(external_wp_data_["useSelect"])(store); - const { - replaceInnerBlocks - } = Object(external_wp_data_["useDispatch"])(store); - const innerBlocks = Object(external_wp_data_["useSelect"])(select => select(store).getBlocks(clientId), [clientId]); // Maintain a reference to the previous value so we can do a deep equality check. - - const existingTemplate = Object(external_wp_element_["useRef"])(null); - Object(external_wp_element_["useLayoutEffect"])(() => { - // Only synchronize innerBlocks with template if innerBlocks are empty or - // a locking all exists directly on the block. - if (innerBlocks.length === 0 || templateLock === 'all') { - const hasTemplateChanged = !Object(external_lodash_["isEqual"])(template, existingTemplate.current); - - if (hasTemplateChanged) { - existingTemplate.current = template; - const nextBlocks = Object(external_wp_blocks_["synchronizeBlocksWithTemplate"])(innerBlocks, template); - - if (!Object(external_lodash_["isEqual"])(nextBlocks, innerBlocks)) { - replaceInnerBlocks(clientId, nextBlocks, innerBlocks.length === 0 && templateInsertUpdatesSelection && nextBlocks.length !== 0, // This ensures the "initialPosition" doesn't change when applying the template - // If we're supposed to focus the block, we'll focus the first inner block - // otherwise, we won't apply any auto-focus. - // This ensures for instance that the focus stays in the inserter when inserting the "buttons" block. - getSelectedBlocksInitialCaretPosition()); - } - } - } - }, [innerBlocks, template, templateLock, clientId]); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/get-block-context.js -/** - * External dependencies - */ - -/** - * Block context cache, implemented as a WeakMap mapping block types to a - * WeakMap mapping attributes object to context value. - * - * @type {WeakMap>} - */ - -const BLOCK_CONTEXT_CACHE = new WeakMap(); -/** - * Returns a cached context object value for a given set of attributes for the - * block type. - * - * @param {Record} attributes Block attributes object. - * @param {WPBlockType} blockType Block type settings. - * - * @return {Record} Context value. - */ - -function getBlockContext(attributes, blockType) { - if (!BLOCK_CONTEXT_CACHE.has(blockType)) { - BLOCK_CONTEXT_CACHE.set(blockType, new WeakMap()); - } - - const blockTypeCache = BLOCK_CONTEXT_CACHE.get(blockType); - - if (!blockTypeCache.has(attributes)) { - const context = Object(external_lodash_["mapValues"])(blockType.providesContext, attributeName => attributes[attributeName]); - blockTypeCache.set(attributes, context); - } - - return blockTypeCache.get(attributes); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/index.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - - - - - - - - - - -/** - * InnerBlocks is a component which allows a single block to have multiple blocks - * as children. The UncontrolledInnerBlocks component is used whenever the inner - * blocks are not controlled by another entity. In other words, it is normally - * used for inner blocks in the post editor - * - * @param {Object} props The component props. - */ - -function UncontrolledInnerBlocks(props) { - const { - clientId, - allowedBlocks, - template, - templateLock, - wrapperRef, - templateInsertUpdatesSelection, - __experimentalCaptureToolbars: captureToolbars, - __experimentalAppenderTagName, - renderAppender, - orientation, - placeholder, - __experimentalLayout - } = props; - useNestedSettingsUpdate(clientId, allowedBlocks, templateLock, captureToolbars, orientation); - useInnerBlockTemplateSync(clientId, template, templateLock, templateInsertUpdatesSelection); - const context = Object(external_wp_data_["useSelect"])(select => { - const block = select(store).getBlock(clientId); - const blockType = Object(external_wp_blocks_["getBlockType"])(block.name); - - if (!blockType || !blockType.providesContext) { - return; - } - - return getBlockContext(block.attributes, blockType); - }, [clientId]); // This component needs to always be synchronous as it's the one changing - // the async mode depending on the block selection. - - return Object(external_wp_element_["createElement"])(BlockContextProvider, { - value: context - }, Object(external_wp_element_["createElement"])(BlockListItems, { - rootClientId: clientId, - renderAppender: renderAppender, - __experimentalAppenderTagName: __experimentalAppenderTagName, - __experimentalLayout: __experimentalLayout, - wrapperRef: wrapperRef, - placeholder: placeholder - })); -} -/** - * The controlled inner blocks component wraps the uncontrolled inner blocks - * component with the blockSync hook. This keeps the innerBlocks of the block in - * the block-editor store in sync with the blocks of the controlling entity. An - * example of an inner block controller is a template part block, which provides - * its own blocks from the template part entity data source. - * - * @param {Object} props The component props. - */ - - -function ControlledInnerBlocks(props) { - useBlockSync(props); - return Object(external_wp_element_["createElement"])(UncontrolledInnerBlocks, props); -} - -const ForwardedInnerBlocks = Object(external_wp_element_["forwardRef"])((props, ref) => { - const innerBlocksProps = useInnerBlocksProps({ - ref - }, props); - return Object(external_wp_element_["createElement"])("div", { - className: "block-editor-inner-blocks" - }, Object(external_wp_element_["createElement"])("div", innerBlocksProps)); -}); -/** - * This hook is used to lightly mark an element as an inner blocks wrapper - * element. Call this hook and pass the returned props to the element to mark as - * an inner blocks wrapper, automatically rendering inner blocks as children. If - * you define a ref for the element, it is important to pass the ref to this - * hook, which the hook in turn will pass to the component through the props it - * returns. Optionally, you can also pass any other props through this hook, and - * they will be merged and returned. - * - * @param {Object} props Optional. Props to pass to the element. Must contain - * the ref if one is defined. - * @param {Object} options Optional. Inner blocks options. - * - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md - */ - -function useInnerBlocksProps(props = {}, options = {}) { - const { - clientId - } = useBlockEditContext(); - const isSmallScreen = Object(external_wp_compose_["useViewportMatch"])('medium', '<'); - const hasOverlay = Object(external_wp_data_["useSelect"])(select => { - const { - getBlockName, - isBlockSelected, - hasSelectedInnerBlock, - isNavigationMode - } = select(store); - const enableClickThrough = isNavigationMode() || isSmallScreen; - return getBlockName(clientId) !== 'core/template' && !isBlockSelected(clientId) && !hasSelectedInnerBlock(clientId, true) && enableClickThrough; - }, [clientId, isSmallScreen]); - const ref = Object(external_wp_compose_["useMergeRefs"])([props.ref, useBlockDropZone({ - rootClientId: clientId - })]); - const InnerBlocks = options.value && options.onChange ? ControlledInnerBlocks : UncontrolledInnerBlocks; - return { ...props, - ref, - className: classnames_default()(props.className, 'block-editor-block-list__layout', { - 'has-overlay': hasOverlay - }), - children: Object(external_wp_element_["createElement"])(InnerBlocks, Object(esm_extends["a" /* default */])({}, options, { - clientId: clientId - })) - }; -} // Expose default appender placeholders as components. - -ForwardedInnerBlocks.DefaultBlockAppender = inner_blocks_default_block_appender; -ForwardedInnerBlocks.ButtonBlockAppender = inner_blocks_button_block_appender; -ForwardedInnerBlocks.Content = Object(external_wp_blocks_["withBlockContentContext"])(({ - BlockContent -}) => Object(external_wp_element_["createElement"])(BlockContent, null)); -/** - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md - */ - -/* harmony default export */ var inner_blocks = (ForwardedInnerBlocks); - -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-left.js - - -/** - * WordPress dependencies - */ - -const justifyLeft = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { - d: "M9 9v6h11V9H9zM4 20h1.5V4H4v16z" -})); -/* harmony default export */ var justify_left = (justifyLeft); - -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-center.js - - -/** - * WordPress dependencies - */ - -const justifyCenter = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { - d: "M20 9h-7.2V4h-1.6v5H4v6h7.2v5h1.6v-5H20z" -})); -/* harmony default export */ var justify_center = (justifyCenter); - -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-right.js - - -/** - * WordPress dependencies - */ - -const justifyRight = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { - d: "M4 15h11V9H4v6zM18.5 4v16H20V4h-1.5z" -})); -/* harmony default export */ var justify_right = (justifyRight); - -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-space-between.js - - -/** - * WordPress dependencies - */ - -const justifySpaceBetween = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { - d: "M9 15h6V9H9v6zm-5 5h1.5V4H4v16zM18.5 4v16H20V4h-1.5z" -})); -/* harmony default export */ var justify_space_between = (justifySpaceBetween); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/justify-content-control/ui.js - - - -/** - * WordPress dependencies - */ - - - -const icons = { - left: justify_left, - center: justify_center, - right: justify_right, - 'space-between': justify_space_between -}; - -function JustifyContentUI({ - allowedControls = ['left', 'center', 'right', 'space-between'], - isCollapsed = true, - onChange, - value, - popoverProps, - isToolbar -}) { - // If the control is already selected we want a click - // again on the control to deselect the item, so we - // call onChange( undefined ) - const handleClick = next => { - if (next === value) { - onChange(undefined); - } else { - onChange(next); - } - }; - - const icon = value ? icons[value] : icons.left; - const allControls = [{ - name: 'left', - icon: justify_left, - title: Object(external_wp_i18n_["__"])('Justify items left'), - isActive: 'left' === value, - onClick: () => handleClick('left') - }, { - name: 'center', - icon: justify_center, - title: Object(external_wp_i18n_["__"])('Justify items center'), - isActive: 'center' === value, - onClick: () => handleClick('center') - }, { - name: 'right', - icon: justify_right, - title: Object(external_wp_i18n_["__"])('Justify items right'), - isActive: 'right' === value, - onClick: () => handleClick('right') - }, { - name: 'space-between', - icon: justify_space_between, - title: Object(external_wp_i18n_["__"])('Space between items'), - isActive: 'space-between' === value, - onClick: () => handleClick('space-between') - }]; - const UIComponent = isToolbar ? external_wp_components_["ToolbarGroup"] : external_wp_components_["ToolbarDropdownMenu"]; - const extraProps = isToolbar ? { - isCollapsed - } : {}; - return Object(external_wp_element_["createElement"])(UIComponent, Object(esm_extends["a" /* default */])({ - icon: icon, - popoverProps: popoverProps, - label: Object(external_wp_i18n_["__"])('Change items justification'), - controls: allControls.filter(elem => allowedControls.includes(elem.name)) - }, extraProps)); -} - -/* harmony default export */ var justify_content_control_ui = (JustifyContentUI); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/justify-content-control/index.js - - - -/** - * Internal dependencies - */ - -function JustifyContentControl(props) { - return Object(external_wp_element_["createElement"])(justify_content_control_ui, Object(esm_extends["a" /* default */])({}, props, { - isToolbar: false - })); -} -function JustifyToolbar(props) { - return Object(external_wp_element_["createElement"])(justify_content_control_ui, Object(esm_extends["a" /* default */])({}, props, { - isToolbar: true - })); -} - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/keyboard-return.js -var keyboard_return = __webpack_require__("btIw"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/settings-drawer.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - -const defaultSettings = [{ - id: 'opensInNewTab', - title: Object(external_wp_i18n_["__"])('Open in new tab') -}]; - -const LinkControlSettingsDrawer = ({ - value, - onChange = external_lodash_["noop"], - settings = defaultSettings -}) => { - if (!settings || !settings.length) { - return null; - } - - const handleSettingChange = setting => newValue => { - onChange({ ...value, - [setting.id]: newValue - }); - }; - - const theSettings = settings.map(setting => Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { - className: "block-editor-link-control__setting", - key: setting.id, - label: setting.title, - onChange: handleSettingChange(setting), - checked: value ? !!value[setting.id] : false - })); - return Object(external_wp_element_["createElement"])("fieldset", { - className: "block-editor-link-control__settings" - }, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { - as: "legend" - }, Object(external_wp_i18n_["__"])('Currently selected link settings')), theSettings); -}; - -/* harmony default export */ var settings_drawer = (LinkControlSettingsDrawer); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-input/index.js - - - -/** - * External dependencies - */ - - - -/** - * WordPress dependencies - */ - - - - - - - - -/** - * Internal dependencies - */ - - - -class url_input_URLInput extends external_wp_element_["Component"] { - constructor(props) { - super(props); - this.onChange = this.onChange.bind(this); - this.onFocus = this.onFocus.bind(this); - this.onKeyDown = this.onKeyDown.bind(this); - this.selectLink = this.selectLink.bind(this); - this.handleOnClick = this.handleOnClick.bind(this); - this.bindSuggestionNode = this.bindSuggestionNode.bind(this); - this.autocompleteRef = props.autocompleteRef || Object(external_wp_element_["createRef"])(); - this.inputRef = Object(external_wp_element_["createRef"])(); - this.updateSuggestions = Object(external_lodash_["debounce"])(this.updateSuggestions.bind(this), 200); - this.suggestionNodes = []; - this.isUpdatingSuggestions = false; - this.state = { - suggestions: [], - showSuggestions: false, - selectedSuggestion: null, - suggestionsListboxId: '', - suggestionOptionIdPrefix: '' - }; - } - - componentDidUpdate(prevProps) { - const { - showSuggestions, - selectedSuggestion - } = this.state; - const { - value - } = this.props; // only have to worry about scrolling selected suggestion into view - // when already expanded - - if (showSuggestions && selectedSuggestion !== null && this.suggestionNodes[selectedSuggestion] && !this.scrollingIntoView) { - this.scrollingIntoView = true; - dom_scroll_into_view_lib_default()(this.suggestionNodes[selectedSuggestion], this.autocompleteRef.current, { - onlyScrollIfNeeded: true - }); - this.props.setTimeout(() => { - this.scrollingIntoView = false; - }, 100); - } // Only attempt an update on suggestions if the input value has actually changed. - - - if (prevProps.value !== value && this.shouldShowInitialSuggestions()) { - this.updateSuggestions(); - } - } - - componentDidMount() { - if (this.shouldShowInitialSuggestions()) { - this.updateSuggestions(); - } - } - - componentWillUnmount() { - var _this$suggestionsRequ, _this$suggestionsRequ2; - - (_this$suggestionsRequ = this.suggestionsRequest) === null || _this$suggestionsRequ === void 0 ? void 0 : (_this$suggestionsRequ2 = _this$suggestionsRequ.cancel) === null || _this$suggestionsRequ2 === void 0 ? void 0 : _this$suggestionsRequ2.call(_this$suggestionsRequ); - delete this.suggestionsRequest; - } - - bindSuggestionNode(index) { - return ref => { - this.suggestionNodes[index] = ref; - }; - } - - shouldShowInitialSuggestions() { - const { - suggestions - } = this.state; - const { - __experimentalShowInitialSuggestions = false, - value - } = this.props; - return !this.isUpdatingSuggestions && __experimentalShowInitialSuggestions && !(value && value.length) && !(suggestions && suggestions.length); - } - - updateSuggestions(value = '') { - const { - __experimentalFetchLinkSuggestions: fetchLinkSuggestions, - __experimentalHandleURLSuggestions: handleURLSuggestions - } = this.props; - - if (!fetchLinkSuggestions) { - return; - } - - const isInitialSuggestions = !(value && value.length); // Allow a suggestions request if: - // - there are at least 2 characters in the search input (except manual searches where - // search input length is not required to trigger a fetch) - // - this is a direct entry (eg: a URL) - - if (!isInitialSuggestions && (value.length < 2 || !handleURLSuggestions && Object(external_wp_url_["isURL"])(value))) { - this.setState({ - showSuggestions: false, - selectedSuggestion: null, - loading: false - }); - return; - } - - this.isUpdatingSuggestions = true; - this.setState({ - selectedSuggestion: null, - loading: true - }); - const request = fetchLinkSuggestions(value, { - isInitialSuggestions - }); - request.then(suggestions => { - // 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 (this.suggestionsRequest !== request) { - return; - } - - this.setState({ - suggestions, - loading: false, - showSuggestions: !!suggestions.length - }); - - if (!!suggestions.length) { - this.props.debouncedSpeak(Object(external_wp_i18n_["sprintf"])( - /* translators: %s: number of results. */ - Object(external_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.', suggestions.length), suggestions.length), 'assertive'); - } else { - this.props.debouncedSpeak(Object(external_wp_i18n_["__"])('No results.'), 'assertive'); - } - - this.isUpdatingSuggestions = false; - }).catch(() => { - if (this.suggestionsRequest === request) { - this.setState({ - loading: false - }); - this.isUpdatingSuggestions = false; - } - }); // Note that this assignment is handled *before* the async search request - // as a Promise always resolves on the next tick of the event loop. - - this.suggestionsRequest = request; - } - - onChange(event) { - const inputValue = event.target.value; - this.props.onChange(inputValue); - - if (!this.props.disableSuggestions) { - this.updateSuggestions(inputValue.trim()); - } - } - - onFocus() { - const { - suggestions - } = this.state; - const { - disableSuggestions, - value - } = this.props; // When opening the link editor, if there's a value present, we want to load the suggestions pane with the results for this input search value - // Don't re-run the suggestions on focus if there are already suggestions present (prevents searching again when tabbing between the input and buttons) - - if (value && !disableSuggestions && !this.isUpdatingSuggestions && !(suggestions && suggestions.length)) { - // Ensure the suggestions are updated with the current input value - this.updateSuggestions(value.trim()); - } - } - - onKeyDown(event) { - const { - showSuggestions, - selectedSuggestion, - suggestions, - loading - } = this.state; // 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 || !suggestions.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_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_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; - } - - const suggestion = this.state.suggestions[this.state.selectedSuggestion]; - - switch (event.keyCode) { - case external_wp_keycodes_["UP"]: - { - event.stopPropagation(); - event.preventDefault(); - const previousIndex = !selectedSuggestion ? suggestions.length - 1 : selectedSuggestion - 1; - this.setState({ - selectedSuggestion: previousIndex - }); - break; - } - - case external_wp_keycodes_["DOWN"]: - { - event.stopPropagation(); - event.preventDefault(); - const nextIndex = selectedSuggestion === null || selectedSuggestion === suggestions.length - 1 ? 0 : selectedSuggestion + 1; - this.setState({ - selectedSuggestion: nextIndex - }); - break; - } - - case external_wp_keycodes_["TAB"]: - { - if (this.state.selectedSuggestion !== null) { - this.selectLink(suggestion); // Announce a link has been selected when tabbing away from the input field. - - this.props.speak(Object(external_wp_i18n_["__"])('Link selected.')); - } - - break; - } - - case external_wp_keycodes_["ENTER"]: - { - if (this.state.selectedSuggestion !== null) { - event.stopPropagation(); - this.selectLink(suggestion); - } - - break; - } - } - } - - selectLink(suggestion) { - this.props.onChange(suggestion.url, suggestion); - this.setState({ - selectedSuggestion: null, - showSuggestions: false - }); - } - - handleOnClick(suggestion) { - this.selectLink(suggestion); // Move focus to the input field when a link suggestion is clicked. - - this.inputRef.current.focus(); - } - - static getDerivedStateFromProps({ - value, - instanceId, - disableSuggestions, - __experimentalShowInitialSuggestions = false - }, { - showSuggestions - }) { - let shouldShowSuggestions = showSuggestions; - const hasValue = value && value.length; - - if (!__experimentalShowInitialSuggestions && !hasValue) { - shouldShowSuggestions = false; - } - - if (disableSuggestions === true) { - shouldShowSuggestions = false; - } - - return { - showSuggestions: shouldShowSuggestions, - suggestionsListboxId: `block-editor-url-input-suggestions-${instanceId}`, - suggestionOptionIdPrefix: `block-editor-url-input-suggestion-${instanceId}` - }; - } - - render() { - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, this.renderControl(), this.renderSuggestions()); - } - - renderControl() { - const { - label, - className, - isFullWidth, - instanceId, - placeholder = Object(external_wp_i18n_["__"])('Paste URL or type to search'), - __experimentalRenderControl: renderControl, - value = '' - } = this.props; - const { - loading, - showSuggestions, - selectedSuggestion, - suggestionsListboxId, - suggestionOptionIdPrefix - } = this.state; - const controlProps = { - id: `url-input-control-${instanceId}`, - label, - className: classnames_default()('block-editor-url-input', className, { - 'is-full-width': isFullWidth - }) - }; - const inputProps = { - value, - required: true, - className: 'block-editor-url-input__input', - type: 'text', - onChange: this.onChange, - onFocus: this.onFocus, - placeholder, - onKeyDown: this.onKeyDown, - role: 'combobox', - 'aria-label': Object(external_wp_i18n_["__"])('URL'), - 'aria-expanded': showSuggestions, - 'aria-autocomplete': 'list', - 'aria-owns': suggestionsListboxId, - 'aria-activedescendant': selectedSuggestion !== null ? `${suggestionOptionIdPrefix}-${selectedSuggestion}` : undefined, - ref: this.inputRef - }; - - if (renderControl) { - return renderControl(controlProps, inputProps, loading); - } - - return Object(external_wp_element_["createElement"])(external_wp_components_["BaseControl"], controlProps, Object(external_wp_element_["createElement"])("input", inputProps), loading && Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null)); - } - - renderSuggestions() { - const { - className, - __experimentalRenderSuggestions: renderSuggestions, - value = '', - __experimentalShowInitialSuggestions = false - } = this.props; - const { - showSuggestions, - suggestions, - selectedSuggestion, - suggestionsListboxId, - suggestionOptionIdPrefix, - loading - } = this.state; - const suggestionsListProps = { - id: suggestionsListboxId, - ref: this.autocompleteRef, - role: 'listbox' - }; - - const buildSuggestionItemProps = (suggestion, index) => { - return { - role: 'option', - tabIndex: '-1', - id: `${suggestionOptionIdPrefix}-${index}`, - ref: this.bindSuggestionNode(index), - 'aria-selected': index === selectedSuggestion - }; - }; - - if (Object(external_lodash_["isFunction"])(renderSuggestions) && showSuggestions && !!suggestions.length) { - return renderSuggestions({ - suggestions, - selectedSuggestion, - suggestionsListProps, - buildSuggestionItemProps, - isLoading: loading, - handleSuggestionClick: this.handleOnClick, - isInitialSuggestions: __experimentalShowInitialSuggestions && !(value && value.length) - }); - } - - if (!Object(external_lodash_["isFunction"])(renderSuggestions) && showSuggestions && !!suggestions.length) { - return Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], { - position: "bottom", - noArrow: true, - focusOnMount: false - }, Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({}, suggestionsListProps, { - className: classnames_default()('block-editor-url-input__suggestions', `${className}__suggestions`) - }), suggestions.map((suggestion, index) => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, buildSuggestionItemProps(suggestion, index), { - key: suggestion.id, - className: classnames_default()('block-editor-url-input__suggestion', { - 'is-selected': index === selectedSuggestion - }), - onClick: () => this.handleOnClick(suggestion) - }), suggestion.title)))); - } - - return null; - } - -} -/** - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-input/README.md - */ - - -/* harmony default export */ var url_input = (Object(external_wp_compose_["compose"])(external_wp_compose_["withSafeTimeout"], external_wp_components_["withSpokenMessages"], external_wp_compose_["withInstanceId"], Object(external_wp_data_["withSelect"])((select, props) => { - // If a link suggestions handler is already provided then - // bail - if (Object(external_lodash_["isFunction"])(props.__experimentalFetchLinkSuggestions)) { - return; - } - - const { - getSettings - } = select(store); - return { - __experimentalFetchLinkSuggestions: getSettings().__experimentalFetchLinkSuggestions - }; -}))(url_input_URLInput)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-create-button.js - - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - - -const LinkControlSearchCreate = ({ - searchTerm, - onClick, - itemProps, - isSelected, - buttonText -}) => { - if (!searchTerm) { - return null; - } - - let text; - - if (buttonText) { - text = Object(external_lodash_["isFunction"])(buttonText) ? buttonText(searchTerm) : buttonText; - } else { - text = Object(external_wp_element_["createInterpolateElement"])(Object(external_wp_i18n_["sprintf"])( - /* translators: %s: search term. */ - Object(external_wp_i18n_["__"])('Create: %s'), searchTerm), { - mark: Object(external_wp_element_["createElement"])("mark", null) - }); - } - - return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, itemProps, { - className: classnames_default()('block-editor-link-control__search-create block-editor-link-control__search-item', { - 'is-selected': isSelected - }), - onClick: onClick - }), Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { - className: "block-editor-link-control__search-item-icon", - icon: plus["a" /* default */] - }), Object(external_wp_element_["createElement"])("span", { - className: "block-editor-link-control__search-item-header" - }, Object(external_wp_element_["createElement"])("span", { - className: "block-editor-link-control__search-item-title" - }, text))); -}; -/* harmony default export */ var search_create_button = (LinkControlSearchCreate); - -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/globe.js - - -/** - * WordPress dependencies - */ - -const globe = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "-2 -2 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { - d: "M9 0C4.03 0 0 4.03 0 9s4.03 9 9 9 9-4.03 9-9-4.03-9-9-9zM1.11 9.68h2.51c.04.91.167 1.814.38 2.7H1.84c-.403-.85-.65-1.764-.73-2.7zm8.57-5.4V1.19c.964.366 1.756 1.08 2.22 2 .205.347.386.708.54 1.08l-2.76.01zm3.22 1.35c.232.883.37 1.788.41 2.7H9.68v-2.7h3.22zM8.32 1.19v3.09H5.56c.154-.372.335-.733.54-1.08.462-.924 1.255-1.64 2.22-2.01zm0 4.44v2.7H4.7c.04-.912.178-1.817.41-2.7h3.21zm-4.7 2.69H1.11c.08-.936.327-1.85.73-2.7H4c-.213.886-.34 1.79-.38 2.7zM4.7 9.68h3.62v2.7H5.11c-.232-.883-.37-1.788-.41-2.7zm3.63 4v3.09c-.964-.366-1.756-1.08-2.22-2-.205-.347-.386-.708-.54-1.08l2.76-.01zm1.35 3.09v-3.04h2.76c-.154.372-.335.733-.54 1.08-.464.92-1.256 1.634-2.22 2v-.04zm0-4.44v-2.7h3.62c-.04.912-.178 1.817-.41 2.7H9.68zm4.71-2.7h2.51c-.08.936-.327 1.85-.73 2.7H14c.21-.87.337-1.757.38-2.65l.01-.05zm0-1.35c-.046-.894-.176-1.78-.39-2.65h2.16c.403.85.65 1.764.73 2.7l-2.5-.05zm1-4H13.6c-.324-.91-.793-1.76-1.39-2.52 1.244.56 2.325 1.426 3.14 2.52h.04zm-9.6-2.52c-.597.76-1.066 1.61-1.39 2.52H2.65c.815-1.094 1.896-1.96 3.14-2.52zm-3.15 12H4.4c.324.91.793 1.76 1.39 2.52-1.248-.567-2.33-1.445-3.14-2.55l-.01.03zm9.56 2.52c.597-.76 1.066-1.61 1.39-2.52h1.76c-.82 1.08-1.9 1.933-3.14 2.48l-.01.04z" -})); -/* harmony default export */ var library_globe = (globe); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-item.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - -const LinkControlSearchItem = ({ - itemProps, - suggestion, - isSelected = false, - onClick, - isURL = false, - searchTerm = '', - shouldShowType = false -}) => { - return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, itemProps, { - onClick: onClick, - className: classnames_default()('block-editor-link-control__search-item', { - 'is-selected': isSelected, - 'is-url': isURL, - 'is-entity': !isURL - }) - }), isURL && Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { - className: "block-editor-link-control__search-item-icon", - icon: library_globe - }), Object(external_wp_element_["createElement"])("span", { - className: "block-editor-link-control__search-item-header" - }, Object(external_wp_element_["createElement"])("span", { - className: "block-editor-link-control__search-item-title" - }, Object(external_wp_element_["createElement"])(external_wp_components_["TextHighlight"], { - text: suggestion.title, - highlight: searchTerm - })), Object(external_wp_element_["createElement"])("span", { - "aria-hidden": !isURL, - className: "block-editor-link-control__search-item-info" - }, !isURL && (Object(external_wp_url_["filterURLForDisplay"])(Object(external_wp_url_["safeDecodeURI"])(suggestion.url)) || ''), isURL && Object(external_wp_i18n_["__"])('Press ENTER to add this link'))), shouldShowType && suggestion.type && Object(external_wp_element_["createElement"])("span", { - className: "block-editor-link-control__search-item-type" - }, suggestion.type === 'post_tag' ? 'tag' : suggestion.type)); -}; -/* harmony default export */ var search_item = (LinkControlSearchItem); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/constants.js -// Used as a unique identifier for the "Create" option within search results. -// Used to help distinguish the "Create" suggestion within the search results in -// order to handle it as a unique case. -const CREATE_TYPE = '__CREATE__'; - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-results.js - - -/** - * WordPress dependencies - */ - - -/** - * External dependencies - */ - - - -/** - * Internal dependencies - */ - - - - -function LinkControlSearchResults({ - instanceId, - withCreateSuggestion, - currentInputValue, - handleSuggestionClick, - suggestionsListProps, - buildSuggestionItemProps, - suggestions, - selectedSuggestion, - isLoading, - isInitialSuggestions, - createSuggestionButtonText, - suggestionsQuery -}) { - const resultsListClasses = classnames_default()('block-editor-link-control__search-results', { - 'is-loading': isLoading - }); - const directLinkEntryTypes = ['url', 'mailto', 'tel', 'internal']; - const isSingleDirectEntryResult = suggestions.length === 1 && directLinkEntryTypes.includes(suggestions[0].type.toLowerCase()); - const shouldShowCreateSuggestion = withCreateSuggestion && !isSingleDirectEntryResult && !isInitialSuggestions; // If the query has a specified type, then we can skip showing them in the result. See #24839. - - const shouldShowSuggestionsTypes = !(suggestionsQuery !== null && suggestionsQuery !== void 0 && suggestionsQuery.type); // According to guidelines aria-label should be added if the label - // itself is not visible. - // See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role - - const searchResultsLabelId = `block-editor-link-control-search-results-label-${instanceId}`; - const labelText = isInitialSuggestions ? Object(external_wp_i18n_["__"])('Recently updated') : Object(external_wp_i18n_["sprintf"])( - /* translators: %s: search term. */ - Object(external_wp_i18n_["__"])('Search results for "%s"'), currentInputValue); // VisuallyHidden rightly doesn't accept custom classNames - // so we conditionally render it as a wrapper to visually hide the label - // when that is required. - - const searchResultsLabel = Object(external_wp_element_["createElement"])(isInitialSuggestions ? external_wp_element_["Fragment"] : external_wp_components_["VisuallyHidden"], {}, // empty props - Object(external_wp_element_["createElement"])("span", { - className: "block-editor-link-control__search-results-label", - id: searchResultsLabelId - }, labelText)); - return Object(external_wp_element_["createElement"])("div", { - className: "block-editor-link-control__search-results-wrapper" - }, searchResultsLabel, Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({}, suggestionsListProps, { - className: resultsListClasses, - "aria-labelledby": searchResultsLabelId - }), suggestions.map((suggestion, index) => { - if (shouldShowCreateSuggestion && CREATE_TYPE === suggestion.type) { - return Object(external_wp_element_["createElement"])(search_create_button, { - searchTerm: currentInputValue, - buttonText: createSuggestionButtonText, - onClick: () => handleSuggestionClick(suggestion) // Intentionally only using `type` here as - // the constant is enough to uniquely - // identify the single "CREATE" suggestion. - , - key: suggestion.type, - itemProps: buildSuggestionItemProps(suggestion, index), - isSelected: index === selectedSuggestion - }); - } // If we're not handling "Create" suggestions above then - // we don't want them in the main results so exit early - - - if (CREATE_TYPE === suggestion.type) { - return null; - } - - return Object(external_wp_element_["createElement"])(search_item, { - key: `${suggestion.id}-${suggestion.type}`, - itemProps: buildSuggestionItemProps(suggestion, index), - suggestion: suggestion, - index: index, - onClick: () => { - handleSuggestionClick(suggestion); - }, - isSelected: index === selectedSuggestion, - isURL: directLinkEntryTypes.includes(suggestion.type.toLowerCase()), - searchTerm: currentInputValue, - shouldShowType: shouldShowSuggestionsTypes - }); - }))); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/is-url-like.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -/** - * Determines whether a given value could be a URL. Note this does not - * guarantee the value is a URL only that it looks like it might be one. For - * example, just because a string has `www.` in it doesn't make it a URL, - * but it does make it highly likely that it will be so in the context of - * creating a link it makes sense to treat it like one. - * - * @param {string} val the candidate for being URL-like (or not). - * @return {boolean} whether or not the value is potentially a URL. - */ - -function isURLLike(val) { - const isInternal = Object(external_lodash_["startsWith"])(val, '#'); - return Object(external_wp_url_["isURL"])(val) || val && val.includes('www.') || isInternal; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-search-handler.js -/** - * WordPress dependencies - */ - - - -/** - * External dependencies - */ - - -/** - * Internal dependencies - */ - - - - -const handleNoop = () => Promise.resolve([]); -const handleDirectEntry = val => { - let type = 'URL'; - const protocol = Object(external_wp_url_["getProtocol"])(val) || ''; - - if (protocol.includes('mailto')) { - type = 'mailto'; - } - - if (protocol.includes('tel')) { - type = 'tel'; - } - - if (Object(external_lodash_["startsWith"])(val, '#')) { - type = 'internal'; - } - - return Promise.resolve([{ - id: val, - title: val, - url: type === 'URL' ? Object(external_wp_url_["prependHTTP"])(val) : val, - type - }]); -}; - -const handleEntitySearch = async (val, suggestionsQuery, fetchSearchSuggestions, directEntryHandler, withCreateSuggestion, withURLSuggestion) => { - const { - isInitialSuggestions - } = suggestionsQuery; - let results = await Promise.all([fetchSearchSuggestions(val, suggestionsQuery), directEntryHandler(val)]); - const couldBeURL = !val.includes(' '); // If it's potentially a URL search then concat on a URL search suggestion - // just for good measure. That way once the actual results run out we always - // have a URL option to fallback on. - - if (couldBeURL && withURLSuggestion && !isInitialSuggestions) { - results = results[0].concat(results[1]); - } else { - results = results[0]; - } // If displaying initial suggestions just return plain results. - - - if (isInitialSuggestions) { - return results; - } // Here we append a faux suggestion to represent a "CREATE" option. This - // is detected in the rendering of the search results and handled as a - // special case. This is currently necessary because the suggestions - // dropdown will only appear if there are valid suggestions and - // therefore unless the create option is a suggestion it will not - // display in scenarios where there are no results returned from the - // API. In addition promoting CREATE to a first class suggestion affords - // the a11y benefits afforded by `URLInput` to all suggestions (eg: - // keyboard handling, ARIA roles...etc). - // - // Note also that the value of the `title` and `url` properties must correspond - // to the text value of the ``. This is because `title` is used - // when creating the suggestion. Similarly `url` is used when using keyboard to select - // the suggestion (the
`onSubmit` handler falls-back to `url`). - - - return isURLLike(val) || !withCreateSuggestion ? results : results.concat({ - // the `id` prop is intentionally ommitted here because it - // is never exposed as part of the component's public API. - // see: https://github.com/WordPress/gutenberg/pull/19775#discussion_r378931316. - title: val, - // must match the existing ``s text value - url: val, - // must match the existing ``s text value - type: CREATE_TYPE - }); -}; - -function useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggestion, withURLSuggestion) { - const { - fetchSearchSuggestions - } = Object(external_wp_data_["useSelect"])(select => { - const { - getSettings - } = select(store); - return { - fetchSearchSuggestions: getSettings().__experimentalFetchLinkSuggestions - }; - }, []); - const directEntryHandler = allowDirectEntry ? handleDirectEntry : handleNoop; - return Object(external_wp_element_["useCallback"])((val, { - isInitialSuggestions - }) => { - return isURLLike(val) ? directEntryHandler(val, { - isInitialSuggestions - }) : handleEntitySearch(val, { ...suggestionsQuery, - isInitialSuggestions - }, fetchSearchSuggestions, directEntryHandler, withCreateSuggestion, withURLSuggestion); - }, [directEntryHandler, fetchSearchSuggestions, withCreateSuggestion]); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-input.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - - -const noopSearchHandler = Promise.resolve([]); -const LinkControlSearchInput = Object(external_wp_element_["forwardRef"])(({ - value, - children, - currentLink = {}, - className = null, - placeholder = null, - withCreateSuggestion = false, - onCreateSuggestion = external_lodash_["noop"], - onChange = external_lodash_["noop"], - onSelect = external_lodash_["noop"], - showSuggestions = true, - renderSuggestions = props => Object(external_wp_element_["createElement"])(LinkControlSearchResults, props), - fetchSuggestions = null, - allowDirectEntry = true, - showInitialSuggestions = false, - suggestionsQuery = {}, - withURLSuggestion = true, - createSuggestionButtonText -}, ref) => { - const genericSearchHandler = useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggestion, withURLSuggestion); - const searchHandler = showSuggestions ? fetchSuggestions || genericSearchHandler : noopSearchHandler; - const instanceId = Object(external_wp_compose_["useInstanceId"])(LinkControlSearchInput); - const [focusedSuggestion, setFocusedSuggestion] = Object(external_wp_element_["useState"])(); - /** - * Handles the user moving between different suggestions. Does not handle - * choosing an individual item. - * - * @param {string} selection the url of the selected suggestion. - * @param {Object} suggestion the suggestion object. - */ - - const onInputChange = (selection, suggestion) => { - onChange(selection); - setFocusedSuggestion(suggestion); - }; - - const onFormSubmit = event => { - event.preventDefault(); - onSuggestionSelected(focusedSuggestion || { - url: value - }); - }; - - const handleRenderSuggestions = props => renderSuggestions({ ...props, - instanceId, - withCreateSuggestion, - currentInputValue: value, - createSuggestionButtonText, - suggestionsQuery, - handleSuggestionClick: suggestion => { - if (props.handleSuggestionClick) { - props.handleSuggestionClick(suggestion); - } - - onSuggestionSelected(suggestion); - } - }); - - const onSuggestionSelected = async selectedSuggestion => { - let suggestion = selectedSuggestion; - - if (CREATE_TYPE === selectedSuggestion.type) { - // Create a new page and call onSelect with the output from the onCreateSuggestion callback - try { - var _suggestion; - - suggestion = await onCreateSuggestion(selectedSuggestion.title); - - if ((_suggestion = suggestion) !== null && _suggestion !== void 0 && _suggestion.url) { - onSelect(suggestion); - } - } catch (e) {} - - return; - } - - if (allowDirectEntry || suggestion && Object.keys(suggestion).length >= 1) { - onSelect( // Some direct entries don't have types or IDs, and we still need to clear the previous ones. - { ...Object(external_lodash_["omit"])(currentLink, 'id', 'url'), - ...suggestion - }, suggestion); - } - }; - - return Object(external_wp_element_["createElement"])("form", { - onSubmit: onFormSubmit - }, Object(external_wp_element_["createElement"])(url_input, { - className: className, - value: value, - onChange: onInputChange, - placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : Object(external_wp_i18n_["__"])('Search or type url'), - __experimentalRenderSuggestions: showSuggestions ? handleRenderSuggestions : null, - __experimentalFetchLinkSuggestions: searchHandler, - __experimentalHandleURLSuggestions: true, - __experimentalShowInitialSuggestions: showInitialSuggestions, - ref: ref - }), children); -}); -/* harmony default export */ var search_input = (LinkControlSearchInput); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/viewer-slot.js -/** - * WordPress dependencies - */ - -const { - Slot: ViewerSlot, - Fill: ViewerFill -} = Object(external_wp_components_["createSlotFill"])('BlockEditorLinkControlViewer'); - -/* harmony default export */ var viewer_slot = (ViewerSlot); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/link-preview.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - -function LinkPreview({ - value, - onEditClick -}) { - const displayURL = value && Object(external_wp_url_["filterURLForDisplay"])(Object(external_wp_url_["safeDecodeURI"])(value.url), 16) || ''; - return Object(external_wp_element_["createElement"])("div", { - "aria-label": Object(external_wp_i18n_["__"])('Currently selected'), - "aria-selected": "true", - className: classnames_default()('block-editor-link-control__search-item', { - 'is-current': true - }) - }, Object(external_wp_element_["createElement"])("span", { - className: "block-editor-link-control__search-item-header" - }, Object(external_wp_element_["createElement"])(external_wp_components_["ExternalLink"], { - className: "block-editor-link-control__search-item-title", - href: value.url - }, value && value.title || displayURL), value && value.title && Object(external_wp_element_["createElement"])("span", { - className: "block-editor-link-control__search-item-info" - }, displayURL)), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - isSecondary: true, - onClick: () => onEditClick(), - className: "block-editor-link-control__search-item-action" - }, Object(external_wp_i18n_["__"])('Edit')), Object(external_wp_element_["createElement"])(ViewerSlot, { - fillProps: value - })); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-create-page.js -/** - * WordPress dependencies - */ - - -function useCreatePage(handleCreatePage) { - const cancelableCreateSuggestion = Object(external_wp_element_["useRef"])(); - const [isCreatingPage, setIsCreatingPage] = Object(external_wp_element_["useState"])(false); - const [errorMessage, setErrorMessage] = Object(external_wp_element_["useState"])(null); - - const createPage = async function (suggestionTitle) { - setIsCreatingPage(true); - setErrorMessage(null); - - try { - // Make cancellable in order that we can avoid setting State - // if the component unmounts during the call to `createSuggestion` - cancelableCreateSuggestion.current = makeCancelable( // Using Promise.resolve to allow createSuggestion to return a - // non-Promise based value. - Promise.resolve(handleCreatePage(suggestionTitle))); - return await cancelableCreateSuggestion.current.promise; - } catch (error) { - if (error && error.isCanceled) { - return; // bail if canceled to avoid setting state - } - - setErrorMessage(error.message || Object(external_wp_i18n_["__"])('An unknown error occurred during creation. Please try again.')); - throw error; - } finally { - setIsCreatingPage(false); - } - }; - /** - * Handles cancelling any pending Promises that have been made cancelable. - */ - - - Object(external_wp_element_["useEffect"])(() => { - return () => { - // componentDidUnmount - if (cancelableCreateSuggestion.current) { - cancelableCreateSuggestion.current.cancel(); - } - }; - }, []); - return { - createPage, - isCreatingPage, - errorMessage - }; -} -/** - * Creates a wrapper around a promise which allows it to be programmatically - * cancelled. - * See: https://reactjs.org/blog/2015/12/16/ismounted-antipattern.html - * - * @param {Promise} promise the Promise to make cancelable - */ - -const makeCancelable = promise => { - let hasCanceled_ = false; - const wrappedPromise = new Promise((resolve, reject) => { - promise.then(val => hasCanceled_ ? reject({ - isCanceled: true - }) : resolve(val), error => hasCanceled_ ? reject({ - isCanceled: true - }) : reject(error)); - }); - return { - promise: wrappedPromise, - - cancel() { - hasCanceled_ = true; - } - - }; -}; - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/index.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - - - - -/** - * Default properties associated with a link control value. - * - * @typedef WPLinkControlDefaultValue - * - * @property {string} url Link URL. - * @property {string=} title Link title. - * @property {boolean=} opensInNewTab Whether link should open in a new browser - * tab. This value is only assigned if not - * providing a custom `settings` prop. - */ - -/* eslint-disable jsdoc/valid-types */ - -/** - * Custom settings values associated with a link. - * - * @typedef {{[setting:string]:any}} WPLinkControlSettingsValue - */ - -/* eslint-enable */ - -/** - * Custom settings values associated with a link. - * - * @typedef WPLinkControlSetting - * - * @property {string} id Identifier to use as property for setting value. - * @property {string} title Human-readable label to show in user interface. - */ - -/** - * Properties associated with a link control value, composed as a union of the - * default properties and any custom settings values. - * - * @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue - */ - -/** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */ - -/** - * Properties associated with a search suggestion used within the LinkControl. - * - * @typedef WPLinkControlSuggestion - * - * @property {string} id Identifier to use to uniquely identify the suggestion. - * @property {string} type Identifies the type of the suggestion (eg: `post`, - * `page`, `url`...etc) - * @property {string} title Human-readable label to show in user interface. - * @property {string} url A URL for the suggestion. - */ - -/** @typedef {(title:string)=>WPLinkControlSuggestion} WPLinkControlCreateSuggestionProp */ - -/** - * @typedef WPLinkControlProps - * - * @property {(WPLinkControlSetting[])=} settings An array of settings objects. Each object will used to - * render a `ToggleControl` for that setting. - * @property {boolean=} forceIsEditingLink If passed as either `true` or `false`, controls the - * internal editing state of the component to respective - * show or not show the URL input field. - * @property {WPLinkControlValue=} value Current link value. - * @property {WPLinkControlOnChangeProp=} onChange Value change handler, called with the updated value if - * the user selects a new link or updates settings. - * @property {boolean=} noDirectEntry Whether to allow turning a URL-like search query directly into a link. - * @property {boolean=} showSuggestions Whether to present suggestions when typing the URL. - * @property {boolean=} showInitialSuggestions Whether to present initial suggestions immediately. - * @property {boolean=} withCreateSuggestion Whether to allow creation of link value from suggestion. - * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions. - * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL. - * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion. - */ - -/** - * Renders a link control. A link control is a controlled input which maintains - * a value associated with a link (HTML anchor element) and relevant settings - * for how that link is expected to behave. - * - * @param {WPLinkControlProps} props Component props. - */ - -function LinkControl({ - searchInputPlaceholder, - value, - settings, - onChange = external_lodash_["noop"], - noDirectEntry = false, - showSuggestions = true, - showInitialSuggestions, - forceIsEditingLink, - createSuggestion, - withCreateSuggestion, - inputValue: propInputValue = '', - suggestionsQuery = {}, - noURLSuggestion = false, - createSuggestionButtonText -}) { - if (withCreateSuggestion === undefined && createSuggestion) { - withCreateSuggestion = true; - } - - const isMounting = Object(external_wp_element_["useRef"])(true); - const wrapperNode = Object(external_wp_element_["useRef"])(); - const [internalInputValue, setInternalInputValue] = Object(external_wp_element_["useState"])(value && value.url || ''); - const currentInputValue = propInputValue || internalInputValue; - const [isEditingLink, setIsEditingLink] = Object(external_wp_element_["useState"])(forceIsEditingLink !== undefined ? forceIsEditingLink : !value || !value.url); - const isEndingEditWithFocus = Object(external_wp_element_["useRef"])(false); - Object(external_wp_element_["useEffect"])(() => { - if (forceIsEditingLink !== undefined && forceIsEditingLink !== isEditingLink) { - setIsEditingLink(forceIsEditingLink); - } - }, [forceIsEditingLink]); - Object(external_wp_element_["useEffect"])(() => { - if (isMounting.current) { - isMounting.current = false; - return; - } // When `isEditingLink` changes, a focus loss could occur - // since the link input may be removed from the DOM. To avoid this, - // reinstate focus to a suitable target if focus has in-fact been lost. - // Note that the check is necessary because while typically unsetting - // edit mode would render the read-only mode's link element, it isn't - // guaranteed. The link input may continue to be shown if the next value - // is still unassigned after calling `onChange`. - - - const hadFocusLoss = !wrapperNode.current.contains(wrapperNode.current.ownerDocument.activeElement); - - if (hadFocusLoss) { - // Prefer to focus a natural focusable descendent of the wrapper, - // but settle for the wrapper if there are no other options. - const nextFocusTarget = external_wp_dom_["focus"].focusable.find(wrapperNode.current)[0] || wrapperNode.current; - nextFocusTarget.focus(); - } - - isEndingEditWithFocus.current = false; - }, [isEditingLink]); - /** - * Cancels editing state and marks that focus may need to be restored after - * the next render, if focus was within the wrapper when editing finished. - */ - - function stopEditing() { - var _wrapperNode$current; - - isEndingEditWithFocus.current = !!((_wrapperNode$current = wrapperNode.current) !== null && _wrapperNode$current !== void 0 && _wrapperNode$current.contains(wrapperNode.current.ownerDocument.activeElement)); - setIsEditingLink(false); - } - - const { - createPage, - isCreatingPage, - errorMessage - } = useCreatePage(createSuggestion); - - const handleSelectSuggestion = updatedValue => { - onChange(updatedValue); - stopEditing(); - }; - - return Object(external_wp_element_["createElement"])("div", { - tabIndex: -1, - ref: wrapperNode, - className: "block-editor-link-control" - }, isCreatingPage && Object(external_wp_element_["createElement"])("div", { - className: "block-editor-link-control__loading" - }, Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null), " ", Object(external_wp_i18n_["__"])('Creating'), "\u2026"), (isEditingLink || !value) && !isCreatingPage && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-link-control__search-input-wrapper" - }, Object(external_wp_element_["createElement"])(search_input, { - currentLink: value, - className: "block-editor-link-control__search-input", - placeholder: searchInputPlaceholder, - value: currentInputValue, - withCreateSuggestion: withCreateSuggestion, - onCreateSuggestion: createPage, - onChange: setInternalInputValue, - onSelect: handleSelectSuggestion, - showInitialSuggestions: showInitialSuggestions, - allowDirectEntry: !noDirectEntry, - showSuggestions: showSuggestions, - suggestionsQuery: suggestionsQuery, - withURLSuggestion: !noURLSuggestion, - createSuggestionButtonText: createSuggestionButtonText - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-link-control__search-actions" - }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - type: "submit", - label: Object(external_wp_i18n_["__"])('Submit'), - icon: keyboard_return["a" /* default */], - className: "block-editor-link-control__search-submit" - })))), errorMessage && Object(external_wp_element_["createElement"])(external_wp_components_["Notice"], { - className: "block-editor-link-control__search-error", - status: "error", - isDismissible: false - }, errorMessage)), value && !isEditingLink && !isCreatingPage && Object(external_wp_element_["createElement"])(LinkPreview, { - value: value, - onEditClick: () => setIsEditingLink(true) - }), Object(external_wp_element_["createElement"])(settings_drawer, { - value: value, - settings: settings, - onChange: onChange - })); -} - -LinkControl.ViewerFill = ViewerFill; -/* harmony default export */ var link_control = (LinkControl); - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/media.js -var library_media = __webpack_require__("rH4q"); - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/upload.js -var upload = __webpack_require__("NTP4"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-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 {WPComponent} The component to be rendered. - */ - -const MediaUpload = () => null; -/** - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-upload/README.md - */ - - -/* harmony default export */ var media_upload = (Object(external_wp_components_["withFilters"])('editor.MediaUpload')(MediaUpload)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/media-upload/check.js -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - -function MediaUploadCheck({ - fallback = null, - children -}) { - const hasUploadPermissions = Object(external_wp_data_["useSelect"])(select => { - const { - getSettings - } = select(store); - return !!getSettings().mediaUpload; - }, []); - return hasUploadPermissions ? children : fallback; -} -/** - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-upload/README.md - */ - -/* harmony default export */ var check = (MediaUploadCheck); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/media-replace-flow/index.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - - - - - -/** - * Internal dependencies - */ - - - - - - -const MediaReplaceFlow = ({ - mediaURL, - mediaId, - allowedTypes, - accept, - onSelect, - onSelectURL, - onFilesUpload = external_lodash_["noop"], - name = Object(external_wp_i18n_["__"])('Replace'), - createNotice, - removeNotice -}) => { - const [mediaURLValue, setMediaURLValue] = Object(external_wp_element_["useState"])(mediaURL); - const mediaUpload = Object(external_wp_data_["useSelect"])(select => { - return select(store).getSettings().mediaUpload; - }, []); - const editMediaButtonRef = Object(external_wp_element_["createRef"])(); - const errorNoticeID = Object(external_lodash_["uniqueId"])('block-editor/media-replace-flow/error-notice/'); - - const onError = message => { - const errorElement = document.createElement('div'); - errorElement.innerHTML = Object(external_wp_element_["renderToString"])(message); // The default error contains some HTML that, - // for example, makes the filename bold. - // The notice, by default, accepts strings only and so - // we need to remove the html from the error. - - const renderMsg = errorElement.textContent || errorElement.innerText || ''; // We need to set a timeout for showing the notice - // so that VoiceOver and possibly other screen readers - // can announce the error afer the toolbar button - // regains focus once the upload dialog closes. - // Otherwise VO simply skips over the notice and announces - // the focused element and the open menu. - - setTimeout(() => { - createNotice('error', renderMsg, { - speak: true, - id: errorNoticeID, - isDismissible: true - }); - }, 1000); - }; - - const selectMedia = media => { - onSelect(media); - setMediaURLValue(media.url); - Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('The media file has been replaced')); - removeNotice(errorNoticeID); - }; - - const selectURL = newURL => { - onSelectURL(newURL); - }; - - const uploadFiles = event => { - const files = event.target.files; - onFilesUpload(files); - - const setMedia = ([media]) => { - selectMedia(media); - }; - - mediaUpload({ - allowedTypes, - filesList: files, - onFileChange: setMedia, - onError - }); - }; - - const openOnArrowDown = event => { - if (event.keyCode === external_wp_keycodes_["DOWN"]) { - event.preventDefault(); - event.stopPropagation(); - event.target.click(); - } - }; - - const POPOVER_PROPS = { - isAlternate: true - }; - return Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], { - popoverProps: POPOVER_PROPS, - contentClassName: "block-editor-media-replace-flow__options", - renderToggle: ({ - isOpen, - onToggle - }) => Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { - ref: editMediaButtonRef, - "aria-expanded": isOpen, - "aria-haspopup": "true", - onClick: onToggle, - onKeyDown: openOnArrowDown - }, name), - renderContent: ({ - onClose - }) => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["NavigableMenu"], { - className: "block-editor-media-replace-flow__media-upload-menu" - }, Object(external_wp_element_["createElement"])(media_upload, { - value: mediaId, - onSelect: media => selectMedia(media), - allowedTypes: allowedTypes, - render: ({ - open - }) => Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { - icon: library_media["a" /* default */], - onClick: open - }, Object(external_wp_i18n_["__"])('Open Media Library')) - }), Object(external_wp_element_["createElement"])(check, null, Object(external_wp_element_["createElement"])(external_wp_components_["FormFileUpload"], { - onChange: event => { - uploadFiles(event, onClose); - }, - accept: accept, - render: ({ - openFileDialog - }) => { - return Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { - icon: upload["a" /* default */], - onClick: () => { - openFileDialog(); - } - }, Object(external_wp_i18n_["__"])('Upload')); - } - }))), onSelectURL && // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions - Object(external_wp_element_["createElement"])("form", { - className: "block-editor-media-flow__url-input", - onKeyDown: event => { - if (![external_wp_keycodes_["TAB"], external_wp_keycodes_["ESCAPE"]].includes(event.keyCode)) { - event.stopPropagation(); - } - }, - onKeyPress: event => { - if (![external_wp_keycodes_["TAB"], external_wp_keycodes_["ESCAPE"]].includes(event.keyCode)) { - event.stopPropagation(); - } - } - }, Object(external_wp_element_["createElement"])("span", { - className: "block-editor-media-replace-flow__image-url-label" - }, Object(external_wp_i18n_["__"])('Current media URL:')), Object(external_wp_element_["createElement"])(link_control, { - value: { - url: mediaURLValue - }, - settings: [], - showSuggestions: false, - onChange: ({ - url - }) => { - setMediaURLValue(url); - selectURL(url); - editMediaButtonRef.current.focus(); - } - }))) - }); -}; - -/* harmony default export */ var media_replace_flow = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withDispatch"])(dispatch => { - const { - createNotice, - removeNotice - } = dispatch(external_wp_notices_["store"]); - return { - createNotice, - removeNotice - }; -}), Object(external_wp_components_["withFilters"])('editor.MediaReplaceFlow')])(MediaReplaceFlow)); - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js + 1 modules -var library_edit = __webpack_require__("B9Az"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-viewer-url.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - -function LinkViewerURL({ - url, - urlLabel, - className -}) { - const linkClassName = classnames_default()(className, 'block-editor-url-popover__link-viewer-url'); - - if (!url) { - return Object(external_wp_element_["createElement"])("span", { - className: linkClassName - }); - } - - return Object(external_wp_element_["createElement"])(external_wp_components_["ExternalLink"], { - className: linkClassName, - href: url - }, urlLabel || Object(external_wp_url_["filterURLForDisplay"])(Object(external_wp_url_["safeDecodeURI"])(url))); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-viewer.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - -function LinkViewer({ - className, - linkClassName, - onEditLinkClick, - url, - urlLabel, - ...props -}) { - return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ - className: classnames_default()('block-editor-url-popover__link-viewer', className) - }, props), Object(external_wp_element_["createElement"])(LinkViewerURL, { - url: url, - urlLabel: urlLabel, - className: linkClassName - }), onEditLinkClick && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - icon: library_edit["a" /* default */], - label: Object(external_wp_i18n_["__"])('Edit'), - onClick: onEditLinkClick - })); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-editor.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - -function LinkEditor({ - autocompleteRef, - className, - onChangeInputValue, - value, - ...props -}) { - return Object(external_wp_element_["createElement"])("form", Object(esm_extends["a" /* default */])({ - className: classnames_default()('block-editor-url-popover__link-editor', className) - }, props), Object(external_wp_element_["createElement"])(url_input, { - value: value, - onChange: onChangeInputValue, - autocompleteRef: autocompleteRef - }), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - icon: keyboard_return["a" /* default */], - label: Object(external_wp_i18n_["__"])('Apply'), - type: "submit" - })); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/index.js - - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - -function URLPopover({ - additionalControls, - children, - renderSettings, - position = 'bottom center', - focusOnMount = 'firstElement', - ...popoverProps -}) { - const [isSettingsExpanded, setIsSettingsExpanded] = Object(external_wp_element_["useState"])(false); - const showSettings = !!renderSettings && isSettingsExpanded; - - const toggleSettingsVisibility = () => { - setIsSettingsExpanded(!isSettingsExpanded); - }; - - return Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], Object(esm_extends["a" /* default */])({ - className: "block-editor-url-popover", - focusOnMount: focusOnMount, - position: position - }, popoverProps), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-url-popover__input-container" - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-url-popover__row" - }, children, !!renderSettings && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - className: "block-editor-url-popover__settings-toggle", - icon: chevron_down["a" /* default */], - label: Object(external_wp_i18n_["__"])('Link settings'), - onClick: toggleSettingsVisibility, - "aria-expanded": isSettingsExpanded - })), showSettings && Object(external_wp_element_["createElement"])("div", { - className: "block-editor-url-popover__row block-editor-url-popover__settings" - }, renderSettings())), additionalControls && !showSettings && Object(external_wp_element_["createElement"])("div", { - className: "block-editor-url-popover__additional-controls" - }, additionalControls)); -} - -URLPopover.LinkEditor = LinkEditor; -URLPopover.LinkViewer = LinkViewer; -/** - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-popover/README.md - */ - -/* harmony default export */ var url_popover = (URLPopover); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/media-placeholder/index.js - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - - - - -/** - * Internal dependencies - */ - - - - - - -const InsertFromURLPopover = ({ - src, - onChange, - onSubmit, - onClose -}) => Object(external_wp_element_["createElement"])(url_popover, { - onClose: onClose -}, Object(external_wp_element_["createElement"])("form", { - className: "block-editor-media-placeholder__url-input-form", - onSubmit: onSubmit -}, Object(external_wp_element_["createElement"])("input", { - className: "block-editor-media-placeholder__url-input-field", - type: "url", - "aria-label": Object(external_wp_i18n_["__"])('URL'), - placeholder: Object(external_wp_i18n_["__"])('Paste or type URL'), - onChange: onChange, - value: src -}), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - className: "block-editor-media-placeholder__url-input-submit-button", - icon: keyboard_return["a" /* default */], - label: Object(external_wp_i18n_["__"])('Apply'), - type: "submit" -}))); - -function MediaPlaceholder({ - value = {}, - allowedTypes, - className, - icon, - labels = {}, - mediaPreview, - notices, - isAppender, - accept, - addToGallery, - multiple = false, - dropZoneUIOnly, - disableDropZone, - disableMediaButtons, - onError, - onSelect, - onCancel, - onSelectURL, - onDoubleClick, - onFilesPreUpload = external_lodash_["noop"], - onHTMLDrop = external_lodash_["noop"], - children -}) { - const mediaUpload = Object(external_wp_data_["useSelect"])(select => { - const { - getSettings - } = select(store); - return getSettings().mediaUpload; - }, []); - const [src, setSrc] = Object(external_wp_element_["useState"])(''); - const [isURLInputVisible, setIsURLInputVisible] = Object(external_wp_element_["useState"])(false); - Object(external_wp_element_["useEffect"])(() => { - var _value$src; - - setSrc((_value$src = value === null || value === void 0 ? void 0 : value.src) !== null && _value$src !== void 0 ? _value$src : ''); - }, [value === null || value === void 0 ? void 0 : value.src]); - - const onlyAllowsImages = () => { - if (!allowedTypes || allowedTypes.length === 0) { - return false; - } - - return allowedTypes.every(allowedType => allowedType === 'image' || allowedType.startsWith('image/')); - }; - - const onChangeSrc = event => { - setSrc(event.target.value); - }; - - const openURLInput = () => { - setIsURLInputVisible(true); - }; - - const closeURLInput = () => { - setIsURLInputVisible(false); - }; - - const onSubmitSrc = event => { - event.preventDefault(); - - if (src && onSelectURL) { - onSelectURL(src); - closeURLInput(); - } - }; - - const onFilesUpload = files => { - onFilesPreUpload(files); - let setMedia; - - if (multiple) { - if (addToGallery) { - // Since the setMedia function runs multiple times per upload group - // and is passed newMedia containing every item in its group each time, we must - // filter out whatever this upload group had previously returned to the - // gallery before adding and returning the image array with replacement newMedia - // values. - // Define an array to store urls from newMedia between subsequent function calls. - let lastMediaPassed = []; - - setMedia = newMedia => { - // Remove any images this upload group is responsible for (lastMediaPassed). - // Their replacements are contained in newMedia. - const filteredMedia = (value !== null && value !== void 0 ? value : []).filter(item => { - // If Item has id, only remove it if lastMediaPassed has an item with that id. - if (item.id) { - return !lastMediaPassed.some( // Be sure to convert to number for comparison. - ({ - id - }) => Number(id) === Number(item.id)); - } // Compare transient images via .includes since gallery may append extra info onto the url. - - - return !lastMediaPassed.some(({ - urlSlug - }) => item.url.includes(urlSlug)); - }); // Return the filtered media array along with newMedia. - - onSelect(filteredMedia.concat(newMedia)); // Reset lastMediaPassed and set it with ids and urls from newMedia. - - lastMediaPassed = newMedia.map(media => { - // Add everything up to '.fileType' to compare via .includes. - const cutOffIndex = media.url.lastIndexOf('.'); - const urlSlug = media.url.slice(0, cutOffIndex); - return { - id: media.id, - urlSlug - }; - }); - }; - } else { - setMedia = onSelect; - } - } else { - setMedia = ([media]) => onSelect(media); - } - - mediaUpload({ - allowedTypes, - filesList: files, - onFileChange: setMedia, - onError - }); - }; - - const onUpload = event => { - onFilesUpload(event.target.files); - }; - - const renderPlaceholder = (content, onClick) => { - let { - instructions, - title - } = labels; - - if (!mediaUpload && !onSelectURL) { - instructions = Object(external_wp_i18n_["__"])('To edit this block, you need permission to upload media.'); - } - - if (instructions === undefined || title === undefined) { - const typesAllowed = allowedTypes !== null && allowedTypes !== void 0 ? allowedTypes : []; - const [firstAllowedType] = typesAllowed; - const isOneType = 1 === typesAllowed.length; - const isAudio = isOneType && 'audio' === firstAllowedType; - const isImage = isOneType && 'image' === firstAllowedType; - const isVideo = isOneType && 'video' === firstAllowedType; - - if (instructions === undefined && mediaUpload) { - instructions = Object(external_wp_i18n_["__"])('Upload a media file or pick one from your media library.'); - - if (isAudio) { - instructions = Object(external_wp_i18n_["__"])('Upload an audio file, pick one from your media library, or add one with a URL.'); - } else if (isImage) { - instructions = Object(external_wp_i18n_["__"])('Upload an image file, pick one from your media library, or add one with a URL.'); - } else if (isVideo) { - instructions = Object(external_wp_i18n_["__"])('Upload a video file, pick one from your media library, or add one with a URL.'); - } - } - - if (title === undefined) { - title = Object(external_wp_i18n_["__"])('Media'); - - if (isAudio) { - title = Object(external_wp_i18n_["__"])('Audio'); - } else if (isImage) { - title = Object(external_wp_i18n_["__"])('Image'); - } else if (isVideo) { - title = Object(external_wp_i18n_["__"])('Video'); - } - } - } - - const placeholderClassName = classnames_default()('block-editor-media-placeholder', className, { - 'is-appender': isAppender - }); - return Object(external_wp_element_["createElement"])(external_wp_components_["Placeholder"], { - icon: icon, - label: title, - instructions: instructions, - className: placeholderClassName, - notices: notices, - onClick: onClick, - onDoubleClick: onDoubleClick, - preview: mediaPreview - }, content, children); - }; - - const renderDropZone = () => { - if (disableDropZone) { - return null; - } - - return Object(external_wp_element_["createElement"])(external_wp_components_["DropZone"], { - onFilesDrop: onFilesUpload, - onHTMLDrop: onHTMLDrop - }); - }; - - const renderCancelLink = () => { - return onCancel && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - className: "block-editor-media-placeholder__cancel-button", - title: Object(external_wp_i18n_["__"])('Cancel'), - isLink: true, - onClick: onCancel - }, Object(external_wp_i18n_["__"])('Cancel')); - }; - - const renderUrlSelectionUI = () => { - return onSelectURL && Object(external_wp_element_["createElement"])("div", { - className: "block-editor-media-placeholder__url-input-container" - }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - className: "block-editor-media-placeholder__button", - onClick: openURLInput, - isPressed: isURLInputVisible, - isTertiary: true - }, Object(external_wp_i18n_["__"])('Insert from URL')), isURLInputVisible && Object(external_wp_element_["createElement"])(InsertFromURLPopover, { - src: src, - onChange: onChangeSrc, - onSubmit: onSubmitSrc, - onClose: closeURLInput - })); - }; - - const renderMediaUploadChecked = () => { - const mediaLibraryButton = Object(external_wp_element_["createElement"])(media_upload, { - addToGallery: addToGallery, - gallery: multiple && onlyAllowsImages(), - multiple: multiple, - onSelect: onSelect, - allowedTypes: allowedTypes, - value: Array.isArray(value) ? value.map(({ - id - }) => id) : value.id, - render: ({ - open - }) => { - return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - isTertiary: true, - onClick: event => { - event.stopPropagation(); - open(); - } - }, Object(external_wp_i18n_["__"])('Media Library')); - } - }); - - if (mediaUpload && isAppender) { - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, renderDropZone(), Object(external_wp_element_["createElement"])(external_wp_components_["FormFileUpload"], { - onChange: onUpload, - accept: accept, - multiple: multiple, - render: ({ - openFileDialog - }) => { - const content = Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - isPrimary: true, - className: classnames_default()('block-editor-media-placeholder__button', 'block-editor-media-placeholder__upload-button') - }, Object(external_wp_i18n_["__"])('Upload')), mediaLibraryButton, renderUrlSelectionUI(), renderCancelLink()); - return renderPlaceholder(content, openFileDialog); - } - })); - } - - if (mediaUpload) { - const content = Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, renderDropZone(), Object(external_wp_element_["createElement"])(external_wp_components_["FormFileUpload"], { - isPrimary: true, - className: classnames_default()('block-editor-media-placeholder__button', 'block-editor-media-placeholder__upload-button'), - onChange: onUpload, - accept: accept, - multiple: multiple - }, Object(external_wp_i18n_["__"])('Upload')), mediaLibraryButton, renderUrlSelectionUI(), renderCancelLink()); - return renderPlaceholder(content); - } - - return renderPlaceholder(mediaLibraryButton); - }; - - if (dropZoneUIOnly || disableMediaButtons) { - if (dropZoneUIOnly) { - external_wp_deprecated_default()('wp.blockEditor.MediaPlaceholder dropZoneUIOnly prop', { - since: '5.4', - alternative: 'disableMediaButtons' - }); - } - - return Object(external_wp_element_["createElement"])(check, null, renderDropZone()); - } - - return Object(external_wp_element_["createElement"])(check, { - fallback: renderPlaceholder(renderUrlSelectionUI()) - }, renderMediaUploadChecked()); -} -/** - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-placeholder/README.md - */ - -/* harmony default export */ var media_placeholder = (Object(external_wp_components_["withFilters"])('editor.MediaPlaceholder')(MediaPlaceholder)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/editable-text/index.js - - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - -const EditableText = Object(external_wp_element_["forwardRef"])((props, ref) => { - return Object(external_wp_element_["createElement"])(rich_text, Object(esm_extends["a" /* default */])({ - ref: ref - }, props, { - __unstableDisableFormats: true, - preserveWhiteSpace: true - })); -}); - -EditableText.Content = ({ - value = '', - tagName: Tag = 'div', - ...props -}) => { - return Object(external_wp_element_["createElement"])(Tag, props, value); -}; -/** - * Renders an editable text input in which text formatting is not allowed. - */ - - -/* harmony default export */ var editable_text = (EditableText); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/plain-text/index.js - - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -/** - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/plain-text/README.md - */ - -const PlainText = Object(external_wp_element_["forwardRef"])(({ - __experimentalVersion, - ...props -}, ref) => { - if (__experimentalVersion === 2) { - return Object(external_wp_element_["createElement"])(editable_text, Object(esm_extends["a" /* default */])({ - ref: ref - }, props)); - } - - const { - className, - onChange, - ...remainingProps - } = props; - return Object(external_wp_element_["createElement"])(lib_default.a, Object(esm_extends["a" /* default */])({ - ref: ref, - className: classnames_default()('block-editor-plain-text', className), - onChange: event => onChange(event.target.value) - }, remainingProps)); -}); -/* harmony default export */ var plain_text = (PlainText); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/responsive-block-control/label.js - - -/** - * WordPress dependencies - */ - - - - -function ResponsiveBlockControlLabel({ - property, - viewport, - desc -}) { - const instanceId = Object(external_wp_compose_["useInstanceId"])(ResponsiveBlockControlLabel); - const accessibleLabel = desc || Object(external_wp_i18n_["sprintf"])( - /* translators: 1: property name. 2: viewport name. */ - Object(external_wp_i18n_["_x"])('Controls the %1$s property for %2$s viewports.', 'Text labelling a interface as controlling a given layout property (eg: margin) for a given screen size.'), property, viewport.label); - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("span", { - "aria-describedby": `rbc-desc-${instanceId}` - }, viewport.label), Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { - as: "span", - id: `rbc-desc-${instanceId}` - }, accessibleLabel)); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/responsive-block-control/index.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - -function ResponsiveBlockControl(props) { - const { - title, - property, - toggleLabel, - onIsResponsiveChange, - renderDefaultControl, - renderResponsiveControls, - isResponsive = false, - defaultLabel = { - id: 'all', - - /* translators: 'Label. Used to signify a layout property (eg: margin, padding) will apply uniformly to all screensizes.' */ - label: Object(external_wp_i18n_["__"])('All') - }, - viewports = [{ - id: 'small', - label: Object(external_wp_i18n_["__"])('Small screens') - }, { - id: 'medium', - label: Object(external_wp_i18n_["__"])('Medium screens') - }, { - id: 'large', - label: Object(external_wp_i18n_["__"])('Large screens') - }] - } = props; - - if (!title || !property || !renderDefaultControl) { - return null; - } - - const toggleControlLabel = toggleLabel || Object(external_wp_i18n_["sprintf"])( - /* translators: 'Toggle control label. Should the property be the same across all screen sizes or unique per screen size.'. %s property value for the control (eg: margin, padding...etc) */ - Object(external_wp_i18n_["__"])('Use the same %s on all screensizes.'), property); - /* translators: 'Help text for the responsive mode toggle control.' */ - - const toggleHelpText = Object(external_wp_i18n_["__"])('Toggle between using the same value for all screen sizes or using a unique value per screen size.'); - - const defaultControl = renderDefaultControl(Object(external_wp_element_["createElement"])(ResponsiveBlockControlLabel, { - property: property, - viewport: defaultLabel - }), defaultLabel); - - const defaultResponsiveControls = () => { - return viewports.map(viewport => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], { - key: viewport.id - }, renderDefaultControl(Object(external_wp_element_["createElement"])(ResponsiveBlockControlLabel, { - property: property, - viewport: viewport - }), viewport))); - }; - - return Object(external_wp_element_["createElement"])("fieldset", { - className: "block-editor-responsive-block-control" - }, Object(external_wp_element_["createElement"])("legend", { - className: "block-editor-responsive-block-control__title" - }, title), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-responsive-block-control__inner" - }, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { - className: "block-editor-responsive-block-control__toggle", - label: toggleControlLabel, - checked: !isResponsive, - onChange: onIsResponsiveChange, - help: toggleHelpText - }), Object(external_wp_element_["createElement"])("div", { - className: classnames_default()('block-editor-responsive-block-control__group', { - 'is-responsive': isResponsive - }) - }, !isResponsive && defaultControl, isResponsive && (renderResponsiveControls ? renderResponsiveControls(viewports) : defaultResponsiveControls())))); -} - -/* harmony default export */ var responsive_block_control = (ResponsiveBlockControl); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/shortcut.js -/** - * WordPress dependencies - */ - - -function RichTextShortcut({ - character, - type, - onUse -}) { - const callback = () => { - onUse(); - return false; - }; - - Object(external_wp_compose_["useKeyboardShortcut"])(external_wp_keycodes_["rawShortcut"][type](character), callback, { - bindGlobal: true - }); - return null; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/toolbar-button.js - - - -/** - * WordPress dependencies - */ - - -function RichTextToolbarButton({ - name, - shortcutType, - shortcutCharacter, - ...props -}) { - let shortcut; - let fillName = 'RichText.ToolbarControls'; - - if (name) { - fillName += `.${name}`; - } - - if (shortcutType && shortcutCharacter) { - shortcut = external_wp_keycodes_["displayShortcut"][shortcutType](shortcutCharacter); - } - - return Object(external_wp_element_["createElement"])(external_wp_components_["Fill"], { - name: fillName - }, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], Object(esm_extends["a" /* default */])({}, props, { - shortcut: shortcut - }))); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/input-event.js -/** - * WordPress dependencies - */ - -class input_event_unstableRichTextInputEvent extends external_wp_element_["Component"] { - constructor() { - super(...arguments); - this.onInput = this.onInput.bind(this); - } - - onInput(event) { - if (event.inputType === this.props.inputType) { - this.props.onInput(); - } - } - - componentDidMount() { - document.addEventListener('input', this.onInput, true); - } - - componentWillUnmount() { - document.removeEventListener('input', this.onInput, true); - } - - render() { - return null; - } - -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/tool-selector/index.js - - - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - -const selectIcon = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - width: "24", - height: "24", - viewBox: "0 0 24 24" -}, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { - d: "M9.4 20.5L5.2 3.8l14.6 9-2 .3c-.2 0-.4.1-.7.1-.9.2-1.6.3-2.2.5-.8.3-1.4.5-1.8.8-.4.3-.8.8-1.3 1.5-.4.5-.8 1.2-1.2 2l-.3.6-.9 1.9zM7.6 7.1l2.4 9.3c.2-.4.5-.8.7-1.1.6-.8 1.1-1.4 1.6-1.8.5-.4 1.3-.8 2.2-1.1l1.2-.3-8.1-5z" -})); - -function ToolSelector(props, ref) { - const isNavigationTool = Object(external_wp_data_["useSelect"])(select => select(store).isNavigationMode(), []); - const { - setNavigationMode - } = Object(external_wp_data_["useDispatch"])(store); - - const onSwitchMode = mode => { - setNavigationMode(mode === 'edit' ? false : true); - }; - - return Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], { - renderToggle: ({ - isOpen, - onToggle - }) => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, { - ref: ref, - icon: isNavigationTool ? selectIcon : library_edit["a" /* default */], - "aria-expanded": isOpen, - "aria-haspopup": "true", - onClick: onToggle - /* translators: button label text should, if possible, be under 16 characters. */ - , - label: Object(external_wp_i18n_["__"])('Tools') - })), - position: "bottom right", - renderContent: () => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["NavigableMenu"], { - role: "menu", - "aria-label": Object(external_wp_i18n_["__"])('Tools') - }, Object(external_wp_element_["createElement"])(external_wp_components_["MenuItemsChoice"], { - value: isNavigationTool ? 'select' : 'edit', - onSelect: onSwitchMode, - choices: [{ - value: 'edit', - label: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { - icon: library_edit["a" /* default */] - }), Object(external_wp_i18n_["__"])('Edit')) - }, { - value: 'select', - label: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, selectIcon, Object(external_wp_i18n_["__"])('Select')) - }] - })), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-tool-selector__help" - }, Object(external_wp_i18n_["__"])('Tools provide different interactions for selecting, navigating, and editing blocks. Toggle between select and edit by pressing Escape and Enter.'))) - }); -} - -/* harmony default export */ var tool_selector = (Object(external_wp_element_["forwardRef"])(ToolSelector)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/unit-control/index.js - - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - -function UnitControl({ - units: unitsProp, - ...props -}) { - const units = Object(external_wp_components_["__experimentalUseCustomUnits"])({ - availableUnits: useSetting('spacing.units') || ['%', 'px', 'em', 'rem', 'vw'], - units: unitsProp - }); - return Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalUnitControl"], Object(esm_extends["a" /* default */])({ - units: units - }, props)); -} - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/link.js -var library_link = __webpack_require__("Bpkj"); - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-left.js -var arrow_left = __webpack_require__("cjQ8"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-input/button.js - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - -class button_URLInputButton extends external_wp_element_["Component"] { - constructor() { - super(...arguments); - this.toggle = this.toggle.bind(this); - this.submitLink = this.submitLink.bind(this); - this.state = { - expanded: false - }; - } - - toggle() { - this.setState({ - expanded: !this.state.expanded - }); - } - - submitLink(event) { - event.preventDefault(); - this.toggle(); - } - - render() { - const { - url, - onChange - } = this.props; - const { - expanded - } = this.state; - const buttonLabel = url ? Object(external_wp_i18n_["__"])('Edit link') : Object(external_wp_i18n_["__"])('Insert link'); - return Object(external_wp_element_["createElement"])("div", { - className: "block-editor-url-input__button" - }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - icon: library_link["a" /* default */], - label: buttonLabel, - onClick: this.toggle, - className: "components-toolbar__control", - isPressed: !!url - }), expanded && Object(external_wp_element_["createElement"])("form", { - className: "block-editor-url-input__button-modal", - onSubmit: this.submitLink - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-url-input__button-modal-line" - }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - className: "block-editor-url-input__back", - icon: arrow_left["a" /* default */], - label: Object(external_wp_i18n_["__"])('Close'), - onClick: this.toggle - }), Object(external_wp_element_["createElement"])(url_input, { - value: url || '', - onChange: onChange - }), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - icon: keyboard_return["a" /* default */], - label: Object(external_wp_i18n_["__"])('Submit'), - type: "submit" - })))); - } - -} -/** - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-input/README.md - */ - - -/* harmony default export */ var url_input_button = (button_URLInputButton); - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js -var library_close = __webpack_require__("w95h"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/image-url-input-ui.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - -const LINK_DESTINATION_NONE = 'none'; -const LINK_DESTINATION_CUSTOM = 'custom'; -const LINK_DESTINATION_MEDIA = 'media'; -const LINK_DESTINATION_ATTACHMENT = 'attachment'; -const NEW_TAB_REL = ['noreferrer', 'noopener']; -const image_url_input_ui_icon = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { - d: "M0,0h24v24H0V0z", - fill: "none" -}), Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { - d: "m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z" -}), Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { - d: "m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z" -})); - -const ImageURLInputUI = ({ - linkDestination, - onChangeUrl, - url, - mediaType = 'image', - mediaUrl, - mediaLink, - linkTarget, - linkClass, - rel -}) => { - const [isOpen, setIsOpen] = Object(external_wp_element_["useState"])(false); - const openLinkUI = Object(external_wp_element_["useCallback"])(() => { - setIsOpen(true); - }); - const [isEditingLink, setIsEditingLink] = Object(external_wp_element_["useState"])(false); - const [urlInput, setUrlInput] = Object(external_wp_element_["useState"])(null); - const autocompleteRef = Object(external_wp_element_["useRef"])(null); - const startEditLink = Object(external_wp_element_["useCallback"])(() => { - if (linkDestination === LINK_DESTINATION_MEDIA || linkDestination === LINK_DESTINATION_ATTACHMENT) { - setUrlInput(''); - } - - setIsEditingLink(true); - }); - const stopEditLink = Object(external_wp_element_["useCallback"])(() => { - setIsEditingLink(false); - }); - const closeLinkUI = Object(external_wp_element_["useCallback"])(() => { - setUrlInput(null); - stopEditLink(); - setIsOpen(false); - }); - - const removeNewTabRel = currentRel => { - let newRel = currentRel; - - if (currentRel !== undefined && !Object(external_lodash_["isEmpty"])(newRel)) { - if (!Object(external_lodash_["isEmpty"])(newRel)) { - Object(external_lodash_["each"])(NEW_TAB_REL, relVal => { - const regExp = new RegExp('\\b' + relVal + '\\b', 'gi'); - newRel = newRel.replace(regExp, ''); - }); // Only trim if NEW_TAB_REL values was replaced. - - if (newRel !== currentRel) { - newRel = newRel.trim(); - } - - if (Object(external_lodash_["isEmpty"])(newRel)) { - newRel = undefined; - } - } - } - - return newRel; - }; - - const getUpdatedLinkTargetSettings = value => { - const newLinkTarget = value ? '_blank' : undefined; - let updatedRel; - - if (!newLinkTarget && !rel) { - updatedRel = undefined; - } else { - updatedRel = removeNewTabRel(rel); - } - - return { - linkTarget: newLinkTarget, - rel: updatedRel - }; - }; - - const onFocusOutside = Object(external_wp_element_["useCallback"])(() => { - return event => { - // The autocomplete suggestions list renders in a separate popover (in a portal), - // so onFocusOutside fails to detect that a click on a suggestion occurred in the - // LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and - // return to avoid the popover being closed. - const autocompleteElement = autocompleteRef.current; - - if (autocompleteElement && autocompleteElement.contains(event.target)) { - return; - } - - setIsOpen(false); - setUrlInput(null); - stopEditLink(); - }; - }); - const onSubmitLinkChange = Object(external_wp_element_["useCallback"])(() => { - return event => { - if (urlInput) { - var _getLinkDestinations$; - - // It is possible the entered URL actually matches a named link destination. - // This check will ensure our link destination is correct. - const selectedDestination = ((_getLinkDestinations$ = getLinkDestinations().find(destination => destination.url === urlInput)) === null || _getLinkDestinations$ === void 0 ? void 0 : _getLinkDestinations$.linkDestination) || LINK_DESTINATION_CUSTOM; - onChangeUrl({ - href: urlInput, - linkDestination: selectedDestination - }); - } - - stopEditLink(); - setUrlInput(null); - event.preventDefault(); - }; - }); - const onLinkRemove = Object(external_wp_element_["useCallback"])(() => { - onChangeUrl({ - linkDestination: LINK_DESTINATION_NONE, - href: '' - }); - }); - - const getLinkDestinations = () => { - const linkDestinations = [{ - linkDestination: LINK_DESTINATION_MEDIA, - title: Object(external_wp_i18n_["__"])('Media File'), - url: mediaType === 'image' ? mediaUrl : undefined, - icon: image_url_input_ui_icon - }]; - - if (mediaType === 'image' && mediaLink) { - linkDestinations.push({ - linkDestination: LINK_DESTINATION_ATTACHMENT, - title: Object(external_wp_i18n_["__"])('Attachment Page'), - url: mediaType === 'image' ? mediaLink : undefined, - icon: Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" - }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { - d: "M0 0h24v24H0V0z", - fill: "none" - }), Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { - d: "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z" - })) - }); - } - - return linkDestinations; - }; - - const onSetHref = value => { - const linkDestinations = getLinkDestinations(); - let linkDestinationInput; - - if (!value) { - linkDestinationInput = LINK_DESTINATION_NONE; - } else { - linkDestinationInput = (Object(external_lodash_["find"])(linkDestinations, destination => { - return destination.url === value; - }) || { - linkDestination: LINK_DESTINATION_CUSTOM - }).linkDestination; - } - - onChangeUrl({ - linkDestination: linkDestinationInput, - href: value - }); - }; - - const onSetNewTab = value => { - const updatedLinkTarget = getUpdatedLinkTargetSettings(value); - onChangeUrl(updatedLinkTarget); - }; - - const onSetLinkRel = value => { - onChangeUrl({ - rel: value - }); - }; - - const onSetLinkClass = value => { - onChangeUrl({ - linkClass: value - }); - }; - - const advancedOptions = Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { - label: Object(external_wp_i18n_["__"])('Open in new tab'), - onChange: onSetNewTab, - checked: linkTarget === '_blank' - }), Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { - label: Object(external_wp_i18n_["__"])('Link Rel'), - value: removeNewTabRel(rel) || '', - onChange: onSetLinkRel - }), Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { - label: Object(external_wp_i18n_["__"])('Link CSS Class'), - value: linkClass || '', - onChange: onSetLinkClass - })); - const linkEditorValue = urlInput !== null ? urlInput : url; - const urlLabel = (Object(external_lodash_["find"])(getLinkDestinations(), ['linkDestination', linkDestination]) || {}).title; - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { - icon: library_link["a" /* default */], - className: "components-toolbar__control", - label: url ? Object(external_wp_i18n_["__"])('Edit link') : Object(external_wp_i18n_["__"])('Insert link'), - "aria-expanded": isOpen, - onClick: openLinkUI - }), isOpen && Object(external_wp_element_["createElement"])(url_popover, { - onFocusOutside: onFocusOutside(), - onClose: closeLinkUI, - renderSettings: () => advancedOptions, - additionalControls: !linkEditorValue && Object(external_wp_element_["createElement"])(external_wp_components_["NavigableMenu"], null, Object(external_lodash_["map"])(getLinkDestinations(), link => Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { - key: link.linkDestination, - icon: link.icon, - onClick: () => { - setUrlInput(null); - onSetHref(link.url); - stopEditLink(); - } - }, link.title))) - }, (!url || isEditingLink) && Object(external_wp_element_["createElement"])(url_popover.LinkEditor, { - className: "block-editor-format-toolbar__link-container-content", - value: linkEditorValue, - onChangeInputValue: setUrlInput, - onSubmit: onSubmitLinkChange(), - autocompleteRef: autocompleteRef - }), url && !isEditingLink && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(url_popover.LinkViewer, { - className: "block-editor-format-toolbar__link-container-content", - url: url, - onEditLinkClick: startEditLink, - urlLabel: urlLabel - }), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - icon: library_close["a" /* default */], - label: Object(external_wp_i18n_["__"])('Remove link'), - onClick: onLinkRemove - })))); -}; - - - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js -var library_check = __webpack_require__("RMJe"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/preview-options/index.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - -function PreviewOptions({ - children, - className, - isEnabled = true, - deviceType, - setDeviceType -}) { - const isMobile = Object(external_wp_compose_["useViewportMatch"])('small', '<'); - if (isMobile) return null; - const popoverProps = { - className: classnames_default()(className, 'block-editor-post-preview__dropdown-content'), - position: 'bottom left' - }; - const toggleProps = { - isTertiary: true, - className: 'block-editor-post-preview__button-toggle', - disabled: !isEnabled, - - /* translators: button label text should, if possible, be under 16 characters. */ - children: Object(external_wp_i18n_["__"])('Preview') - }; - return Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], { - className: "block-editor-post-preview__dropdown", - popoverProps: popoverProps, - toggleProps: toggleProps, - icon: null - }, () => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { - className: "block-editor-post-preview__button-resize", - onClick: () => setDeviceType('Desktop'), - icon: deviceType === 'Desktop' && library_check["a" /* default */] - }, Object(external_wp_i18n_["__"])('Desktop')), Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { - className: "block-editor-post-preview__button-resize", - onClick: () => setDeviceType('Tablet'), - icon: deviceType === 'Tablet' && library_check["a" /* default */] - }, Object(external_wp_i18n_["__"])('Tablet')), Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { - className: "block-editor-post-preview__button-resize", - onClick: () => setDeviceType('Mobile'), - icon: deviceType === 'Mobile' && library_check["a" /* default */] - }, Object(external_wp_i18n_["__"])('Mobile'))), children)); -} - -// EXTERNAL MODULE: ./node_modules/css-mediaquery/index.js -var css_mediaquery = __webpack_require__("6fKw"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-simulated-media-query/index.js -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - -const ENABLED_MEDIA_QUERY = '(min-width:0px)'; -const DISABLED_MEDIA_QUERY = '(min-width:999999px)'; -const VALID_MEDIA_QUERY_REGEX = /\((min|max)-width:[^\(]*?\)/g; - -function getStyleSheetsThatMatchHostname() { - var _window$document$styl, _window, _window$document; - - if (typeof window === 'undefined') { - return []; - } - - return Object(external_lodash_["filter"])((_window$document$styl = (_window = window) === null || _window === void 0 ? void 0 : (_window$document = _window.document) === null || _window$document === void 0 ? void 0 : _window$document.styleSheets) !== null && _window$document$styl !== void 0 ? _window$document$styl : [], styleSheet => { - if (!styleSheet.href) { - return false; - } - - return Object(external_wp_url_["getProtocol"])(styleSheet.href) === window.location.protocol && Object(external_wp_url_["getAuthority"])(styleSheet.href) === window.location.host; - }); -} - -function isReplaceableMediaRule(rule) { - if (!rule.media) { - return false; - } // Need to use "media.mediaText" instead of "conditionText" for IE support. - - - return !!rule.media.mediaText.match(VALID_MEDIA_QUERY_REGEX); -} - -function replaceRule(styleSheet, newRuleText, index) { - styleSheet.deleteRule(index); - styleSheet.insertRule(newRuleText, index); -} - -function replaceMediaQueryWithWidthEvaluation(ruleText, widthValue) { - return ruleText.replace(VALID_MEDIA_QUERY_REGEX, matchedSubstring => { - if (Object(css_mediaquery["match"])(matchedSubstring, { - type: 'screen', - width: widthValue - })) { - return ENABLED_MEDIA_QUERY; - } - - return DISABLED_MEDIA_QUERY; - }); -} -/** - * Function that manipulates media queries from stylesheets to simulate a given - * viewport width. - * - * @param {string} marker CSS selector string defining start and end of - * manipulable styles. - * @param {number?} width Viewport width to simulate. If provided null, the - * stylesheets will not be modified. - */ - - -function useSimulatedMediaQuery(marker, width) { - Object(external_wp_element_["useEffect"])(() => { - if (!width) { - return; - } - - const styleSheets = getStyleSheetsThatMatchHostname(); - const originalStyles = []; - styleSheets.forEach((styleSheet, styleSheetIndex) => { - let relevantSection = false; - - for (let ruleIndex = 0; ruleIndex < styleSheet.cssRules.length; ++ruleIndex) { - const rule = styleSheet.cssRules[ruleIndex]; - - if (rule.type !== window.CSSRule.STYLE_RULE && rule.type !== window.CSSRule.MEDIA_RULE) { - continue; - } - - if (!relevantSection && !!rule.cssText.match(new RegExp(`#start-${marker}`))) { - relevantSection = true; - } - - if (relevantSection && !!rule.cssText.match(new RegExp(`#end-${marker}`))) { - relevantSection = false; - } - - if (!relevantSection || !isReplaceableMediaRule(rule)) { - continue; - } - - const ruleText = rule.cssText; - - if (!originalStyles[styleSheetIndex]) { - originalStyles[styleSheetIndex] = []; - } - - originalStyles[styleSheetIndex][ruleIndex] = ruleText; - replaceRule(styleSheet, replaceMediaQueryWithWidthEvaluation(ruleText, width), ruleIndex); - } - }); - return () => { - originalStyles.forEach((rulesCollection, styleSheetIndex) => { - if (!rulesCollection) { - return; - } - - for (let ruleIndex = 0; ruleIndex < rulesCollection.length; ++ruleIndex) { - const originalRuleText = rulesCollection[ruleIndex]; - - if (originalRuleText) { - replaceRule(styleSheets[styleSheetIndex], originalRuleText, ruleIndex); - } - } - }); - }; - }, [width]); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-resize-canvas/index.js -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - -/** - * Function to resize the editor window. - * - * @param {string} deviceType Used for determining the size of the container (e.g. Desktop, Tablet, Mobile) - * @param {boolean} __unstableDisableSimulation Whether to disable media query simulation. - * - * @return {Object} Inline styles to be added to resizable container. - */ - -function useResizeCanvas(deviceType, __unstableDisableSimulation) { - const [actualWidth, updateActualWidth] = Object(external_wp_element_["useState"])(window.innerWidth); - Object(external_wp_element_["useEffect"])(() => { - if (deviceType === 'Desktop') { - return; - } - - const resizeListener = () => updateActualWidth(window.innerWidth); - - window.addEventListener('resize', resizeListener); - return () => { - window.removeEventListener('resize', resizeListener); - }; - }, [deviceType]); - - const getCanvasWidth = device => { - let deviceWidth; - - switch (device) { - case 'Tablet': - deviceWidth = 780; - break; - - case 'Mobile': - deviceWidth = 360; - break; - - default: - return null; - } - - return deviceWidth < actualWidth ? deviceWidth : actualWidth; - }; - - const marginValue = () => window.innerHeight < 800 ? 36 : 72; - - const contentInlineStyles = device => { - const height = device === 'Mobile' ? '768px' : '1024px'; - - switch (device) { - case 'Tablet': - case 'Mobile': - return { - width: getCanvasWidth(device), - margin: marginValue() + 'px auto', - height, - borderRadius: '2px 2px 2px 2px', - border: '1px solid #ddd', - overflowY: 'auto' - }; - - default: - return null; - } - }; - - const width = __unstableDisableSimulation ? null : getCanvasWidth(deviceType); - useSimulatedMediaQuery('resizable-editor-section', width); - return contentInlineStyles(deviceType); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/skip-to-selected-block/index.js - - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - - -const SkipToSelectedBlock = ({ - selectedBlockClientId -}) => { - const ref = useBlockRef(selectedBlockClientId); - - const onClick = () => { - ref.current.focus(); - }; - - return selectedBlockClientId ? Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { - isSecondary: true, - className: "block-editor-skip-to-selected-block", - onClick: onClick - }, Object(external_wp_i18n_["__"])('Skip to the selected block')) : null; -}; - -/* harmony default export */ var skip_to_selected_block = (Object(external_wp_data_["withSelect"])(select => { - return { - selectedBlockClientId: select(store).getBlockSelectionStart() - }; -})(SkipToSelectedBlock)); - -// EXTERNAL MODULE: external ["wp","wordcount"] -var external_wp_wordcount_ = __webpack_require__("7fqt"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/multi-selection-inspector/index.js - - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - - -function MultiSelectionInspector({ - blocks -}) { - const words = Object(external_wp_wordcount_["count"])(Object(external_wp_blocks_["serialize"])(blocks), 'words'); - return Object(external_wp_element_["createElement"])("div", { - className: "block-editor-multi-selection-inspector__card" - }, Object(external_wp_element_["createElement"])(BlockIcon, { - icon: library_stack, - showColors: true - }), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-multi-selection-inspector__card-content" - }, Object(external_wp_element_["createElement"])("div", { - className: "block-editor-multi-selection-inspector__card-title" - }, Object(external_wp_i18n_["sprintf"])( - /* translators: %d: number of blocks */ - Object(external_wp_i18n_["_n"])('%d block', '%d blocks', blocks.length), blocks.length)), Object(external_wp_element_["createElement"])("div", { - className: "block-editor-multi-selection-inspector__card-description" - }, Object(external_wp_i18n_["sprintf"])( - /* translators: %d: number of words */ - Object(external_wp_i18n_["_n"])('%d word', '%d words', words), words)))); -} - -/* harmony default export */ var multi_selection_inspector = (Object(external_wp_data_["withSelect"])(select => { - const { - getMultiSelectedBlocks - } = select(store); - return { - blocks: getMultiSelectedBlocks() - }; -})(MultiSelectionInspector)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/default-style-picker/index.js - - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - -function DefaultStylePicker({ - blockName -}) { - const { - preferredStyle, - onUpdatePreferredStyleVariations, - styles - } = Object(external_wp_data_["useSelect"])(select => { - var _preferredStyleVariat, _preferredStyleVariat2; - - const settings = select(store).getSettings(); - const preferredStyleVariations = settings.__experimentalPreferredStyleVariations; - return { - preferredStyle: preferredStyleVariations === null || preferredStyleVariations === void 0 ? void 0 : (_preferredStyleVariat = preferredStyleVariations.value) === null || _preferredStyleVariat === void 0 ? void 0 : _preferredStyleVariat[blockName], - onUpdatePreferredStyleVariations: (_preferredStyleVariat2 = preferredStyleVariations === null || preferredStyleVariations === void 0 ? void 0 : preferredStyleVariations.onChange) !== null && _preferredStyleVariat2 !== void 0 ? _preferredStyleVariat2 : null, - styles: select(external_wp_blocks_["store"]).getBlockStyles(blockName) - }; - }, [blockName]); - const selectOptions = Object(external_wp_element_["useMemo"])(() => [{ - label: Object(external_wp_i18n_["__"])('Not set'), - value: '' - }, ...styles.map(({ - label, - name - }) => ({ - label, - value: name - }))], [styles]); - const selectOnChange = Object(external_wp_element_["useCallback"])(blockStyle => { - onUpdatePreferredStyleVariations(blockName, blockStyle); - }, [blockName, onUpdatePreferredStyleVariations]); - return onUpdatePreferredStyleVariations && Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], { - options: selectOptions, - value: preferredStyle || '', - label: Object(external_wp_i18n_["__"])('Default Style'), - onChange: selectOnChange - }); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-inspector/index.js - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - - - - - - - - - - - -const BlockInspector = ({ - showNoBlockSelectedMessage = true, - bubblesVirtually = true -}) => { - const { - count, - hasBlockStyles, - selectedBlockName, - selectedBlockClientId, - blockType - } = Object(external_wp_data_["useSelect"])(select => { - const { - getSelectedBlockClientId, - getSelectedBlockCount, - getBlockName - } = select(store); - const { - getBlockStyles - } = select(external_wp_blocks_["store"]); - - const _selectedBlockClientId = getSelectedBlockClientId(); - - const _selectedBlockName = _selectedBlockClientId && getBlockName(_selectedBlockClientId); - - const _blockType = _selectedBlockName && Object(external_wp_blocks_["getBlockType"])(_selectedBlockName); - - const blockStyles = _selectedBlockName && getBlockStyles(_selectedBlockName); - - return { - count: getSelectedBlockCount(), - selectedBlockClientId: _selectedBlockClientId, - selectedBlockName: _selectedBlockName, - blockType: _blockType, - hasBlockStyles: blockStyles && blockStyles.length > 0 - }; - }, []); - - if (count > 1) { - return Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-inspector" - }, Object(external_wp_element_["createElement"])(multi_selection_inspector, null), Object(external_wp_element_["createElement"])(inspector_controls.Slot, { - bubblesVirtually: bubblesVirtually - })); - } - - const isSelectedBlockUnregistered = selectedBlockName === Object(external_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) { - if (showNoBlockSelectedMessage) { - return Object(external_wp_element_["createElement"])("span", { - className: "block-editor-block-inspector__no-blocks" - }, Object(external_wp_i18n_["__"])('No block selected.')); - } - - return null; - } - - return Object(external_wp_element_["createElement"])(BlockInspectorSingleBlock, { - clientId: selectedBlockClientId, - blockName: blockType.name, - hasBlockStyles: hasBlockStyles, - bubblesVirtually: bubblesVirtually - }); -}; - -const BlockInspectorSingleBlock = ({ - clientId, - blockName, - hasBlockStyles, - bubblesVirtually -}) => { - const blockInformation = useBlockDisplayInformation(clientId); - return Object(external_wp_element_["createElement"])("div", { - className: "block-editor-block-inspector" - }, Object(external_wp_element_["createElement"])(block_card, blockInformation), Object(external_wp_element_["createElement"])(block_variation_transforms, { - blockClientId: clientId - }), hasBlockStyles && Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { - title: Object(external_wp_i18n_["__"])('Styles') - }, Object(external_wp_element_["createElement"])(block_styles, { - clientId: clientId - }), Object(external_wp_blocks_["hasBlockSupport"])(blockName, 'defaultStylePicker', true) && Object(external_wp_element_["createElement"])(DefaultStylePicker, { - blockName: blockName - }))), Object(external_wp_element_["createElement"])(inspector_controls.Slot, { - bubblesVirtually: bubblesVirtually - }), Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])(AdvancedControls, { - slotName: inspector_advanced_controls.slotName, - bubblesVirtually: bubblesVirtually - })), Object(external_wp_element_["createElement"])(skip_to_selected_block, { - key: "back" - })); -}; - -const AdvancedControls = ({ - slotName, - bubblesVirtually -}) => { - const slot = Object(external_wp_components_["__experimentalUseSlot"])(slotName); - const hasFills = Boolean(slot.fills && slot.fills.length); - - if (!hasFills) { - return null; - } - - return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { - className: "block-editor-block-inspector__advanced", - title: Object(external_wp_i18n_["__"])('Advanced'), - initialOpen: false - }, Object(external_wp_element_["createElement"])(inspector_advanced_controls.Slot, { - bubblesVirtually: bubblesVirtually - })); -}; - -/* harmony default export */ var block_inspector = (BlockInspector); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/index.js - - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - - - - -/** - * Renders block tools (the block toolbar, select/navigation mode toolbar, the - * insertion point and a slot for the inline rich text toolbar). Must be wrapped - * around the block content and editor styles wrapper or iframe. - * - * @param {Object} $0 Props. - * @param {Object} $0.children The block content and style container. - * @param {Object} $0.__unstableContentRef Ref holding the content scroll container. - */ - -function BlockTools({ - children, - __unstableContentRef -}) { - const isLargeViewport = Object(external_wp_compose_["useViewportMatch"])('medium'); - const hasFixedToolbar = Object(external_wp_data_["useSelect"])(select => select(store).getSettings().hasFixedToolbar, []); - return Object(external_wp_element_["createElement"])(InsertionPoint, { - __unstableContentRef: __unstableContentRef - }, (hasFixedToolbar || !isLargeViewport) && Object(external_wp_element_["createElement"])(block_contextual_toolbar, { - isFixed: true - }), Object(external_wp_element_["createElement"])(WrappedBlockPopover, { - __unstableContentRef: __unstableContentRef - }), Object(external_wp_element_["createElement"])(external_wp_components_["Popover"].Slot, { - name: "block-toolbar", - ref: usePopoverScroll(__unstableContentRef) - }), children); -} + srcDoc: "", + title: (0,external_wp_i18n_namespaceObject.__)('Editor canvas') + }), iframeDocument && (0,external_wp_element_namespaceObject.createPortal)((0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("head", { + ref: headRef + }, head), (0,external_wp_element_namespaceObject.createElement)("body", { + ref: bodyRef, + className: classnames_default()(BODY_CLASS_NAME, ...bodyClasses) + }, (0,external_wp_element_namespaceObject.createElement)("div", { + style: { + display: 'none' + }, + ref: styleCompatibilityRef + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalStyleProvider, { + document: iframeDocument + }, children))), iframeDocument.documentElement)), tabIndex >= 0 && after); +} + +/* harmony default export */ var iframe = ((0,external_wp_element_namespaceObject.forwardRef)(Iframe)); + +;// CONCATENATED MODULE: ./node_modules/colord/index.mjs +var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return"number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof j?r:new j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(j,y),S.push(r))})},E=function(){return new j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})}; + +;// CONCATENATED MODULE: ./node_modules/colord/plugins/names.mjs +/* harmony default export */ function names(e,f){var a={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var d,i,n=r[this.toHex()];if(n)return n;if(null==f?void 0:f.closest){var o=this.toRgb(),t=1/0,b="black";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(var g in a){var u=(d=o,i=l[g],Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2));ud?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}} // EXTERNAL MODULE: ./node_modules/traverse/index.js -var traverse = __webpack_require__("eGrx"); +var traverse = __webpack_require__(3124); var traverse_default = /*#__PURE__*/__webpack_require__.n(traverse); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/ast/parse.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-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 const commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g; -/* harmony default export */ var parse = (function (css, options) { +/* harmony default export */ function parse(css, options) { options = options || {}; /** * Positional. @@ -36562,7 +21213,7 @@ function declaration() { - const pos = position(); // prop + const pos = position(); // prop. let prop = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/); @@ -36574,7 +21225,7 @@ if (!match(/^:\s*/)) { return error("property missing ':'"); - } // val + } // val. const val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/); @@ -36599,7 +21250,7 @@ return error("missing '{'"); } - comments(decls); // declarations + comments(decls); // declarations. let decl; // eslint-disable-next-line no-cond-assign @@ -36815,7 +21466,7 @@ return error("@page missing '{'"); } - let decls = comments(); // declarations + let decls = comments(); // declarations. let decl; // eslint-disable-next-line no-cond-assign @@ -36884,7 +21535,7 @@ return error("@font-face missing '{'"); } - let decls = comments(); // declarations + let decls = comments(); // declarations. let decl; // eslint-disable-next-line no-cond-assign @@ -36976,7 +21627,7 @@ } return addParent(stylesheet()); -}); +} /** * Trim `str`. */ @@ -37019,17 +21670,16 @@ /* eslint-enable @wordpress/no-unused-vars-before-return */ // EXTERNAL MODULE: ./node_modules/inherits/inherits_browser.js -var inherits_browser = __webpack_require__("P7XM"); +var inherits_browser = __webpack_require__(8575); var inherits_browser_default = /*#__PURE__*/__webpack_require__.n(inherits_browser); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/ast/stringify/compiler.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-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); +/* harmony default export */ var compiler = (Compiler); /** * Initialize a compiler. */ @@ -37073,7 +21723,7 @@ return buf; }; -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/ast/stringify/compress.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/ast/stringify/compress.js // Adapted from https://github.com/reworkcss/css // because we needed to remove source map support. @@ -37096,14 +21746,14 @@ */ function compress_Compiler(options) { - stringify_compiler.call(this, options); + compiler.call(this, options); } /** * Inherit from `Base.prototype`. */ -inherits_browser_default()(compress_Compiler, stringify_compiler); +inherits_browser_default()(compress_Compiler, compiler); /** * Compile `node`. */ @@ -37241,7 +21891,7 @@ return this.emit(node.property + ':' + node.value, node.position) + this.emit(';'); }; -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/ast/stringify/identity.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-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. @@ -37266,7 +21916,7 @@ function identity_Compiler(options) { options = options || {}; - stringify_compiler.call(this, options); + compiler.call(this, options); this.indentation = options.indent; } /** @@ -37274,7 +21924,7 @@ */ -inherits_browser_default()(identity_Compiler, stringify_compiler); +inherits_browser_default()(identity_Compiler, compiler); /** * Compile `node`. */ @@ -37439,7 +22089,7 @@ }; /* eslint-enable @wordpress/no-unused-vars-before-return */ -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/ast/stringify/index.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/ast/stringify/index.js // Adapted from https://github.com/reworkcss/css // because we needed to remove source map support. @@ -37461,14 +22111,14 @@ * @return {string} */ -/* harmony default export */ var stringify = (function (node, options) { +/* harmony default export */ function stringify(node, options) { options = options || {}; const compiler = options.compress ? new compress(options) : new identity(options); const code = compiler.compile(node); return code; -}); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/traverse.js +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/traverse.js /** * External dependencies */ @@ -37482,7 +22132,7 @@ function traverseCSS(css, callback) { try { const parsed = parse(css); - const updated = traverse_default.a.map(parsed, function (node) { + const updated = traverse_default().map(parsed, function (node) { if (!node) { return node; } @@ -37500,11 +22150,11 @@ /* harmony default export */ var transform_styles_traverse = (traverseCSS); -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/transforms/url-rewrite.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/transforms/url-rewrite.js /** * Return `true` if the given path is http/https. * - * @param {string} filePath path + * @param {string} filePath path * * @return {boolean} is remote path. */ @@ -37514,7 +22164,7 @@ /** * Return `true` if the given filePath is an absolute url. * - * @param {string} filePath path + * @param {string} filePath path * * @return {boolean} is absolute path. */ @@ -37526,21 +22176,21 @@ /** * Whether or not the url should be inluded. * - * @param {Object} meta url meta info + * @param {Object} meta url meta info * * @return {boolean} is valid. */ function isValidURL(meta) { - // ignore hashes or data uris + // 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 + } // Do not handle the http/https urls if `includeRemote` is false. if (isRemotePath(meta.value)) { @@ -37552,10 +22202,10 @@ /** * Get the absolute path of the url, relative to the basePath * - * @param {string} str the url - * @param {string} baseURL base URL - * - * @return {string} the full path to the file + * @param {string} str the url + * @param {string} baseURL base URL + * + * @return {string} the full path to the file */ @@ -37565,8 +22215,9 @@ /** * Process the single `url()` pattern * - * @param {string} baseURL the base URL for relative URLs - * @return {Promise} the Promise + * @param {string} baseURL the base URL for relative URLs. + * + * @return {Promise} the Promise. */ @@ -37578,9 +22229,9 @@ /** * Get all `url()`s, and return the meta info * - * @param {string} value decl.value - * - * @return {Array} the urls + * @param {string} value decl.value. + * + * @return {Array} the urls. */ @@ -37608,10 +22259,10 @@ /** * 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 + * @param {string} raw the raw value. + * @param {Array} URLs the URLs to replace. + * + * @return {string} the new value. */ @@ -37635,40 +22286,59 @@ /* harmony default export */ var url_rewrite = (rewrite); -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/transforms/wrap.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/transforms/wrap.js /** * @constant string IS_ROOT_TAG Regex to check if the selector is a root tag selector. */ const IS_ROOT_TAG = /^(body|html|:root).*$/; - -const wrap = (namespace, ignore = []) => node => { - const updateSelector = selector => { - if (ignore.includes(selector.trim())) { - return selector; - } // Anything other than a root tag is always prefixed. - - - { - if (!selector.match(IS_ROOT_TAG)) { - return namespace + ' ' + selector; - } - } // HTML and Body elements cannot be contained within our container so lets extract their styles. - - return selector.replace(/^(body|html|:root)/, namespace); - }; - - if (node.type === 'rule') { - return { ...node, - selectors: node.selectors.map(updateSelector) - }; - } - - return node; +/** + * Creates a callback to modify selectors so they only apply within a certain + * namespace. + * + * @param {string} namespace Namespace to prefix selectors with. + * @param {string[]} ignore Selectors to not prefix. + * + * @return {(node: Object) => Object} Callback to wrap selectors. + */ + +const wrap = function (namespace) { + let ignore = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + return node => { + /** + * Updates selector if necessary. + * + * @param {string} selector Selector to modify. + * + * @return {string} Updated selector. + */ + const updateSelector = selector => { + if (ignore.includes(selector.trim())) { + return selector; + } // Anything other than a root tag is always prefixed. + + + { + if (!selector.match(IS_ROOT_TAG)) { + return namespace + ' ' + selector; + } + } // HTML and Body elements cannot be contained within our container so lets extract their styles. + + return selector.replace(/^(body|html|:root)/, namespace); + }; + + if (node.type === 'rule') { + return { ...node, + selectors: node.selectors.map(updateSelector) + }; + } + + return node; + }; }; /* harmony default export */ var transforms_wrap = (wrap); -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/index.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/index.js /** * External dependencies */ @@ -37688,20 +22358,21 @@ /** * Applies a series of CSS rule transforms to wrap selectors inside a given class and/or rewrite URLs depending on the parameters passed. * - * @param {Array} styles CSS rules. + * @param {Array} styles CSS rules. * @param {string} wrapperClassName Wrapper Class Name. * @return {Array} converted rules. */ -const transformStyles = (styles, wrapperClassName = '') => { - return Object(external_lodash_["map"])(styles, ({ - css, - baseURL, - __experimentalNoWrapper = false - }) => { +const transform_styles_transformStyles = function (styles) { + let wrapperClassName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + return (0,external_lodash_namespaceObject.map)(styles, _ref => { + let { + css, + baseURL + } = _ref; const transforms = []; - if (wrapperClassName && !__experimentalNoWrapper) { + if (wrapperClassName) { transforms.push(transforms_wrap(wrapperClassName)); } @@ -37710,21 +22381,23 @@ } if (transforms.length) { - return transform_styles_traverse(css, Object(external_wp_compose_["compose"])(transforms)); + return transform_styles_traverse(css, (0,external_wp_compose_namespaceObject.compose)(transforms)); } return css; }); }; -/* harmony default export */ var transform_styles = (transformStyles); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/editor-styles/index.js - - -/** - * External dependencies - */ +/* harmony default export */ var transform_styles = (transform_styles_transformStyles); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/editor-styles/index.js + + +/** + * External dependencies + */ + + /** * WordPress dependencies @@ -37737,9 +22410,10 @@ const EDITOR_STYLES_SELECTOR = '.editor-styles-wrapper'; +k([names, a11y]); function useDarkThemeBodyClassName(styles) { - return Object(external_wp_element_["useCallback"])(node => { + return (0,external_wp_element_namespaceObject.useCallback)(node => { if (!node) { return; } @@ -37765,10 +22439,11 @@ body.removeChild(tempCanvas); } else { backgroundColor = defaultView.getComputedStyle(canvas, null).getPropertyValue('background-color'); - } // If background is transparent, it should be treated as light color. - - - if (tinycolor_default()(backgroundColor).getLuminance() > 0.5 || tinycolor_default()(backgroundColor).getAlpha() === 0) { + } + + const colordBackgroundColor = w(backgroundColor); // If background is transparent, it should be treated as light color. + + if (colordBackgroundColor.luminance() > 0.5 || colordBackgroundColor.alpha() === 0) { body.classList.remove('is-dark-theme'); } else { body.classList.add('is-dark-theme'); @@ -37776,102 +22451,26133 @@ }, [styles]); } -function EditorStyles({ - styles -}) { - const transformedStyles = Object(external_wp_element_["useMemo"])(() => transform_styles(styles, EDITOR_STYLES_SELECTOR), [styles]); - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("style", { +function EditorStyles(_ref) { + let { + styles + } = _ref; + const transformedStyles = (0,external_wp_element_namespaceObject.useMemo)(() => transform_styles(styles, EDITOR_STYLES_SELECTOR), [styles]); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("style", { ref: useDarkThemeBodyClassName(styles) - }), transformedStyles.map((css, index) => Object(external_wp_element_["createElement"])("style", { + }), transformedStyles.map((css, index) => (0,external_wp_element_namespaceObject.createElement)("style", { key: index }, css))); } -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/library.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - - - -function InserterLibrary({ - rootClientId, - clientId, - isAppender, - showInserterHelpPanel, - showMostUsedBlocks = false, - __experimentalInsertionIndex, - onSelect = external_lodash_["noop"], - shouldFocusBlock = false -}) { - const destinationRootClientId = Object(external_wp_data_["useSelect"])(select => { - const { - getBlockRootClientId - } = select(store); - return rootClientId || getBlockRootClientId(clientId) || undefined; - }, [clientId, rootClientId]); - return Object(external_wp_element_["createElement"])(menu, { +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-preview/auto.js + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + + // This is used to avoid rendering the block list if the sizes change. + +let MemoizedBlockList; +const MAX_HEIGHT = 2000; + +function AutoBlockPreview(_ref) { + let { + viewportWidth, + __experimentalPadding, + __experimentalMinHeight + } = _ref; + const [containerResizeListener, { + width: containerWidth + }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); + const [contentResizeListener, { + height: contentHeight + }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); + const { + styles, + assets + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const settings = select(store).getSettings(); + return { + styles: settings.styles, + assets: settings.__unstableResolvedAssets + }; + }, []); // Avoid scrollbars for pattern previews. + + const editorStyles = (0,external_wp_element_namespaceObject.useMemo)(() => { + if (styles) { + return [...styles, { + css: 'body{height:auto;overflow:hidden;}', + __unstableType: 'presets' + }]; + } + + return styles; + }, [styles]); // Initialize on render instead of module top level, to avoid circular dependency issues. + + MemoizedBlockList = MemoizedBlockList || (0,external_wp_compose_namespaceObject.pure)(BlockList); + const scale = containerWidth / viewportWidth; + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-preview__container" + }, containerResizeListener, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Disabled, { + className: "block-editor-block-preview__content", + style: { + transform: `scale(${scale})`, + height: contentHeight * scale, + maxHeight: contentHeight > MAX_HEIGHT ? MAX_HEIGHT * scale : undefined, + minHeight: __experimentalMinHeight + } + }, (0,external_wp_element_namespaceObject.createElement)(iframe, { + head: (0,external_wp_element_namespaceObject.createElement)(EditorStyles, { + styles: editorStyles + }), + assets: assets, + contentRef: (0,external_wp_compose_namespaceObject.useRefEffect)(bodyElement => { + const { + ownerDocument: { + documentElement + } + } = bodyElement; + documentElement.classList.add('block-editor-block-preview__content-iframe'); + documentElement.style.position = 'absolute'; + documentElement.style.width = '100%'; + bodyElement.style.padding = __experimentalPadding + 'px'; // necessary for contentResizeListener to work. + + bodyElement.style.position = 'relative'; + }, []), + "aria-hidden": true, + tabIndex: -1, + style: { + position: 'absolute', + width: viewportWidth, + height: contentHeight, + pointerEvents: 'none', + // This is a catch-all max-height for patterns. + // See: https://github.com/WordPress/gutenberg/pull/38175. + maxHeight: MAX_HEIGHT, + minHeight: scale < 1 && __experimentalMinHeight ? __experimentalMinHeight / scale : __experimentalMinHeight + } + }, contentResizeListener, (0,external_wp_element_namespaceObject.createElement)(MemoizedBlockList, { + renderAppender: false + })))); +} + +/* harmony default export */ var auto = (AutoBlockPreview); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-preview/index.js + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + + + +function BlockPreview(_ref) { + let { + blocks, + __experimentalPadding = 0, + viewportWidth = 1200, + __experimentalLive = false, + __experimentalOnClick, + __experimentalMinHeight + } = _ref; + const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings(), []); + const settings = (0,external_wp_element_namespaceObject.useMemo)(() => { + const _settings = { ...originalSettings + }; + _settings.__experimentalBlockPatterns = []; + return _settings; + }, [originalSettings]); + const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_lodash_namespaceObject.castArray)(blocks), [blocks]); + + if (!blocks || blocks.length === 0) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)(provider, { + value: renderedBlocks, + settings: settings + }, __experimentalLive ? (0,external_wp_element_namespaceObject.createElement)(LiveBlockPreview, { + onClick: __experimentalOnClick + }) : (0,external_wp_element_namespaceObject.createElement)(auto, { + viewportWidth: viewportWidth, + __experimentalPadding: __experimentalPadding, + __experimentalMinHeight: __experimentalMinHeight + })); +} +/** + * BlockPreview renders a preview of a block or array of blocks. + * + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-preview/README.md + * + * @param {Object} preview options for how the preview should be shown + * @param {Array|Object} preview.blocks A block instance (object) or an array of blocks to be previewed. + * @param {number} preview.viewportWidth Width of the preview container in pixels. Controls at what size the blocks will be rendered inside the preview. Default: 700. + * + * @return {WPComponent} The component to be rendered. + */ + +/* harmony default export */ var block_preview = ((0,external_wp_element_namespaceObject.memo)(BlockPreview)); +/** + * This hook is used to lightly mark an element as a block preview wrapper + * element. Call this hook and pass the returned props to the element to mark as + * a block preview wrapper, automatically rendering inner blocks as children. If + * you define a ref for the element, it is important to pass the ref to this + * hook, which the hook in turn will pass to the component through the props it + * returns. Optionally, you can also pass any other props through this hook, and + * they will be merged and returned. + * + * @param {Object} options Preview options. + * @param {WPBlock[]} options.blocks Block objects. + * @param {Object} options.props Optional. Props to pass to the element. Must contain + * the ref if one is defined. + * @param {Object} options.__experimentalLayout Layout settings to be used in the preview. + * + */ + +function useBlockPreview(_ref2) { + let { + blocks, + props = {}, + __experimentalLayout + } = _ref2; + const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings(), []); + const disabledRef = (0,external_wp_compose_namespaceObject.__experimentalUseDisabled)(); + const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([props.ref, disabledRef]); + const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...originalSettings, + __experimentalBlockPatterns: [] + }), [originalSettings]); + const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_lodash_namespaceObject.castArray)(blocks), [blocks]); + const children = (0,external_wp_element_namespaceObject.createElement)(provider, { + value: renderedBlocks, + settings: settings + }, (0,external_wp_element_namespaceObject.createElement)(BlockListItems, { + renderAppender: false, + __experimentalLayout: __experimentalLayout + })); + return { ...props, + ref, + className: classnames_default()(props.className, 'block-editor-block-preview__live-content', 'components-disabled'), + children: blocks !== null && blocks !== void 0 && blocks.length ? children : null + }; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/preview-panel.js + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + + +function InserterPreviewPanel(_ref) { + var _hoveredItemBlockType, _hoveredItemBlockType2; + + let { + item + } = _ref; + const { + name, + title, + icon, + description, + initialAttributes + } = item; + const hoveredItemBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); + const isReusable = (0,external_wp_blocks_namespaceObject.isReusableBlock)(item); + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-inserter__preview-container" + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-inserter__preview" + }, isReusable || hoveredItemBlockType !== null && hoveredItemBlockType !== void 0 && hoveredItemBlockType.example ? (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-inserter__preview-content" + }, (0,external_wp_element_namespaceObject.createElement)(block_preview, { + __experimentalPadding: 16, + viewportWidth: (_hoveredItemBlockType = (_hoveredItemBlockType2 = hoveredItemBlockType.example) === null || _hoveredItemBlockType2 === void 0 ? void 0 : _hoveredItemBlockType2.viewportWidth) !== null && _hoveredItemBlockType !== void 0 ? _hoveredItemBlockType : 500, + blocks: hoveredItemBlockType.example ? (0,external_wp_blocks_namespaceObject.getBlockFromExample)(item.name, { + attributes: { ...hoveredItemBlockType.example.attributes, + ...initialAttributes + }, + innerBlocks: hoveredItemBlockType.example.innerBlocks + }) : (0,external_wp_blocks_namespaceObject.createBlock)(name, initialAttributes) + })) : (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-inserter__preview-content-missing" + }, (0,external_wp_i18n_namespaceObject.__)('No Preview Available.'))), !isReusable && (0,external_wp_element_namespaceObject.createElement)(block_card, { + title: title, + icon: icon, + description: description + })); +} + +/* harmony default export */ var preview_panel = (InserterPreviewPanel); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/context.js +/** + * WordPress dependencies + */ + +const InserterListboxContext = (0,external_wp_element_namespaceObject.createContext)(); +/* harmony default export */ var context = (InserterListboxContext); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/item.js + + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + +function InserterListboxItem(_ref, ref) { + let { + isFirst, + as: Component, + children, + ...props + } = _ref; + const state = (0,external_wp_element_namespaceObject.useContext)(context); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableCompositeItem, _extends({ + ref: ref, + state: state, + role: "option" // Use the CompositeItem `focusable` prop over Button's + // isFocusable. The latter was shown to cause an issue + // with tab order in the inserter list. + , + focusable: true + }, props), htmlProps => { + const propsWithTabIndex = { ...htmlProps, + tabIndex: isFirst ? 0 : htmlProps.tabIndex + }; + + if (Component) { + return (0,external_wp_element_namespaceObject.createElement)(Component, propsWithTabIndex, children); + } + + if (typeof children === 'function') { + return children(propsWithTabIndex); + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, propsWithTabIndex, children); + }); +} + +/* harmony default export */ var inserter_listbox_item = ((0,external_wp_element_namespaceObject.forwardRef)(InserterListboxItem)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/drag-handle.js + + +/** + * WordPress dependencies + */ + +const dragHandle = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + width: "24", + height: "24", + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z" +})); +/* harmony default export */ var drag_handle = (dragHandle); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/draggable-chip.js + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + +function BlockDraggableChip(_ref) { + let { + count, + icon + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-draggable-chip-wrapper" + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-draggable-chip" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { + justify: "center", + className: "block-editor-block-draggable-chip__content" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, icon ? (0,external_wp_element_namespaceObject.createElement)(block_icon, { + icon: icon + }) : (0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %d: Number of blocks. */ + (0,external_wp_i18n_namespaceObject._n)('%d block', '%d blocks', count), count)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(block_icon, { + icon: drag_handle + }))))); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-draggable-blocks/index.js + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + +const InserterDraggableBlocks = _ref => { + let { + isEnabled, + blocks, + icon, + children + } = _ref; + const transferData = { + type: 'inserter', + blocks + }; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Draggable, { + __experimentalTransferDataType: "wp-blocks", + transferData: transferData, + __experimentalDragComponent: (0,external_wp_element_namespaceObject.createElement)(BlockDraggableChip, { + count: blocks.length, + icon: icon + }) + }, _ref2 => { + let { + onDraggableStart, + onDraggableEnd + } = _ref2; + return children({ + draggable: isEnabled, + onDragStart: isEnabled ? onDraggableStart : undefined, + onDragEnd: isEnabled ? onDraggableEnd : undefined + }); + }); +}; + +/* harmony default export */ var inserter_draggable_blocks = (InserterDraggableBlocks); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-list-item/index.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + +/** + * Return true if platform is MacOS. + * + * @param {Object} _window window object by default; used for DI testing. + * + * @return {boolean} True if MacOS; false otherwise. + */ + +function isAppleOS() { + let _window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window; + + const { + platform + } = _window.navigator; + return platform.indexOf('Mac') !== -1 || ['iPad', 'iPhone'].includes(platform); +} + +function InserterListItem(_ref) { + let { + className, + isFirst, + item, + onSelect, + onHover, + isDraggable, + ...props + } = _ref; + const isDragging = (0,external_wp_element_namespaceObject.useRef)(false); + const itemIconStyle = item.icon ? { + backgroundColor: item.icon.background, + color: item.icon.foreground + } : {}; + const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { + return [(0,external_wp_blocks_namespaceObject.createBlock)(item.name, item.initialAttributes, (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(item.innerBlocks))]; + }, [item.name, item.initialAttributes, item.initialAttributes]); + return (0,external_wp_element_namespaceObject.createElement)(inserter_draggable_blocks, { + isEnabled: isDraggable && !item.disabled, + blocks: blocks, + icon: item.icon + }, _ref2 => { + let { + draggable, + onDragStart, + onDragEnd + } = _ref2; + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-types-list__list-item", + draggable: draggable, + onDragStart: event => { + isDragging.current = true; + + if (onDragStart) { + onHover(null); + onDragStart(event); + } + }, + onDragEnd: event => { + isDragging.current = false; + + if (onDragEnd) { + onDragEnd(event); + } + } + }, (0,external_wp_element_namespaceObject.createElement)(inserter_listbox_item, _extends({ + isFirst: isFirst, + className: classnames_default()('block-editor-block-types-list__item', className), + disabled: item.isDisabled, + onClick: event => { + event.preventDefault(); + onSelect(item, isAppleOS() ? event.metaKey : event.ctrlKey); + onHover(null); + }, + onKeyDown: event => { + const { + keyCode + } = event; + + if (keyCode === external_wp_keycodes_namespaceObject.ENTER) { + event.preventDefault(); + onSelect(item, isAppleOS() ? event.metaKey : event.ctrlKey); + onHover(null); + } + }, + onFocus: () => { + if (isDragging.current) { + return; + } + + onHover(item); + }, + onMouseEnter: () => { + if (isDragging.current) { + return; + } + + onHover(item); + }, + onMouseLeave: () => onHover(null), + onBlur: () => onHover(null) + }, props), (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-block-types-list__item-icon", + style: itemIconStyle + }, (0,external_wp_element_namespaceObject.createElement)(block_icon, { + icon: item.icon, + showColors: true + })), (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-block-types-list__item-title" + }, item.title))); + }); +} + +/* harmony default export */ var inserter_list_item = ((0,external_wp_element_namespaceObject.memo)(InserterListItem)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/group.js + + + +/** + * WordPress dependencies + */ + + + + +function InserterListboxGroup(props, ref) { + const [shouldSpeak, setShouldSpeak] = (0,external_wp_element_namespaceObject.useState)(false); + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (shouldSpeak) { + (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to move through blocks')); + } + }, [shouldSpeak]); + return (0,external_wp_element_namespaceObject.createElement)("div", _extends({ + ref: ref, + role: "listbox", + "aria-orientation": "horizontal", + onFocus: () => { + setShouldSpeak(true); + }, + onBlur: event => { + const focusingOutsideGroup = !event.currentTarget.contains(event.relatedTarget); + + if (focusingOutsideGroup) { + setShouldSpeak(false); + } + } + }, props)); +} + +/* harmony default export */ var group = ((0,external_wp_element_namespaceObject.forwardRef)(InserterListboxGroup)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/row.js + + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + +function InserterListboxRow(props, ref) { + const state = (0,external_wp_element_namespaceObject.useContext)(context); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableCompositeGroup, _extends({ + state: state, + role: "presentation", + ref: ref + }, props)); +} + +/* harmony default export */ var inserter_listbox_row = ((0,external_wp_element_namespaceObject.forwardRef)(InserterListboxRow)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-types-list/index.js + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + + +function chunk(array, size) { + const chunks = []; + + for (let i = 0, j = array.length; i < j; i += size) { + chunks.push(array.slice(i, i + size)); + } + + return chunks; +} + +function BlockTypesList(_ref) { + let { + items = [], + onSelect, + onHover = () => {}, + children, + label, + isDraggable = true + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)(group, { + className: "block-editor-block-types-list", + "aria-label": label + }, chunk(items, 3).map((row, i) => (0,external_wp_element_namespaceObject.createElement)(inserter_listbox_row, { + key: i + }, row.map((item, j) => (0,external_wp_element_namespaceObject.createElement)(inserter_list_item, { + key: item.id, + item: item, + className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(item.id), onSelect: onSelect, + onHover: onHover, + isDraggable: isDraggable, + isFirst: i === 0 && j === 0 + })))), children); +} + +/* harmony default export */ var block_types_list = (BlockTypesList); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/panel.js + + +/** + * WordPress dependencies + */ + + +function InserterPanel(_ref) { + let { + title, + icon, + children + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-inserter__panel-header" + }, (0,external_wp_element_namespaceObject.createElement)("h2", { + className: "block-editor-inserter__panel-title" + }, title), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { + icon: icon + })), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-inserter__panel-content" + }, children)); +} + +/* harmony default export */ var panel = (InserterPanel); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-block-types-state.js +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + +/** + * Retrieves the block types inserter state. + * + * @param {string=} rootClientId Insertion's root client ID. + * @param {Function} onInsert function called when inserter a list of blocks. + * @return {Array} Returns the block types state. (block types, categories, collections, onSelect handler) + */ + +const useBlockTypesState = (rootClientId, onInsert) => { + const { + categories, + collections, + items + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getInserterItems + } = select(store); + const { + getCategories, + getCollections + } = select(external_wp_blocks_namespaceObject.store); + return { + categories: getCategories(), + collections: getCollections(), + items: getInserterItems(rootClientId) + }; + }, [rootClientId]); + const onSelectItem = (0,external_wp_element_namespaceObject.useCallback)((_ref, shouldFocusBlock) => { + let { + name, + initialAttributes, + innerBlocks + } = _ref; + const insertedBlock = (0,external_wp_blocks_namespaceObject.createBlock)(name, initialAttributes, (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(innerBlocks)); + onInsert(insertedBlock, undefined, shouldFocusBlock); + }, [onInsert]); + return [items, categories, collections, onSelectItem]; +}; + +/* harmony default export */ var use_block_types_state = (useBlockTypesState); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/index.js + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + + + + +function InserterListbox(_ref) { + let { + children + } = _ref; + const compositeState = (0,external_wp_components_namespaceObject.__unstableUseCompositeState)({ + shift: true, + wrap: 'horizontal' + }); + return (0,external_wp_element_namespaceObject.createElement)(context.Provider, { + value: compositeState + }, children); +} + +/* harmony default export */ var inserter_listbox = (InserterListbox); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-types-tab.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + + + +const getBlockNamespace = item => item.name.split('/')[0]; + +const MAX_SUGGESTED_ITEMS = 6; +/** + * Shared reference to an empty array for cases where it is important to avoid + * returning a new array reference on every invocation and rerendering the component. + * + * @type {Array} + */ + +const block_types_tab_EMPTY_ARRAY = []; +function BlockTypesTab(_ref) { + let { + rootClientId, + onInsert, + onHover, + showMostUsedBlocks + } = _ref; + const [items, categories, collections, onSelectItem] = use_block_types_state(rootClientId, onInsert); + const suggestedItems = (0,external_wp_element_namespaceObject.useMemo)(() => { + return (0,external_lodash_namespaceObject.orderBy)(items, ['frecency'], ['desc']).slice(0, MAX_SUGGESTED_ITEMS); + }, [items]); + const uncategorizedItems = (0,external_wp_element_namespaceObject.useMemo)(() => { + return items.filter(item => !item.category); + }, [items]); + const itemsPerCategory = (0,external_wp_element_namespaceObject.useMemo)(() => { + return (0,external_lodash_namespaceObject.flow)(itemList => itemList.filter(item => item.category && item.category !== 'reusable'), itemList => (0,external_lodash_namespaceObject.groupBy)(itemList, 'category'))(items); + }, [items]); + const itemsPerCollection = (0,external_wp_element_namespaceObject.useMemo)(() => { + // Create a new Object to avoid mutating collection. + const result = { ...collections + }; + Object.keys(collections).forEach(namespace => { + result[namespace] = items.filter(item => getBlockNamespace(item) === namespace); + + if (result[namespace].length === 0) { + delete result[namespace]; + } + }); + return result; + }, [items, collections]); // Hide block preview on unmount. + + (0,external_wp_element_namespaceObject.useEffect)(() => () => onHover(null), []); + /** + * The inserter contains a big number of blocks and opening it is a costful operation. + * The rendering is the most costful part of it, in order to improve the responsiveness + * of the "opening" action, these lazy lists allow us to render the inserter category per category, + * once all the categories are rendered, we start rendering the collections and the uncategorized block types. + */ + + const currentlyRenderedCategories = (0,external_wp_compose_namespaceObject.useAsyncList)(categories); + const didRenderAllCategories = categories.length === currentlyRenderedCategories.length; // Async List requires an array. + + const collectionEntries = (0,external_wp_element_namespaceObject.useMemo)(() => { + return Object.entries(collections); + }, [collections]); + const currentlyRenderedCollections = (0,external_wp_compose_namespaceObject.useAsyncList)(didRenderAllCategories ? collectionEntries : block_types_tab_EMPTY_ARRAY); + return (0,external_wp_element_namespaceObject.createElement)(inserter_listbox, null, (0,external_wp_element_namespaceObject.createElement)("div", null, showMostUsedBlocks && !!suggestedItems.length && (0,external_wp_element_namespaceObject.createElement)(panel, { + title: (0,external_wp_i18n_namespaceObject._x)('Most used', 'blocks') + }, (0,external_wp_element_namespaceObject.createElement)(block_types_list, { + items: suggestedItems, + onSelect: onSelectItem, + onHover: onHover, + label: (0,external_wp_i18n_namespaceObject._x)('Most used', 'blocks') + })), (0,external_lodash_namespaceObject.map)(currentlyRenderedCategories, category => { + const categoryItems = itemsPerCategory[category.slug]; + + if (!categoryItems || !categoryItems.length) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)(panel, { + key: category.slug, + title: category.title, + icon: category.icon + }, (0,external_wp_element_namespaceObject.createElement)(block_types_list, { + items: categoryItems, + onSelect: onSelectItem, + onHover: onHover, + label: category.title + })); + }), didRenderAllCategories && uncategorizedItems.length > 0 && (0,external_wp_element_namespaceObject.createElement)(panel, { + className: "block-editor-inserter__uncategorized-blocks-panel", + title: (0,external_wp_i18n_namespaceObject.__)('Uncategorized') + }, (0,external_wp_element_namespaceObject.createElement)(block_types_list, { + items: uncategorizedItems, + onSelect: onSelectItem, + onHover: onHover, + label: (0,external_wp_i18n_namespaceObject.__)('Uncategorized') + })), (0,external_lodash_namespaceObject.map)(currentlyRenderedCollections, _ref2 => { + let [namespace, collection] = _ref2; + const collectionItems = itemsPerCollection[namespace]; + + if (!collectionItems || !collectionItems.length) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)(panel, { + key: namespace, + title: collection.title, + icon: collection.icon + }, (0,external_wp_element_namespaceObject.createElement)(block_types_list, { + items: collectionItems, + onSelect: onSelectItem, + onHover: onHover, + label: collection.title + })); + }))); +} +/* harmony default export */ var block_types_tab = (BlockTypesTab); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/pattern-panel.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + +function PatternInserterPanel(_ref) { + let { + selectedCategory, + patternCategories, + onClickCategory, + openPatternExplorer + } = _ref; + const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); + + const categoryOptions = () => { + const options = []; + patternCategories.map(patternCategory => { + return options.push({ + value: patternCategory.name, + label: patternCategory.label + }); + }); + return options; + }; + + const onChangeSelect = selected => { + onClickCategory(patternCategories.find(patternCategory => selected === patternCategory.name)); + }; + + const className = classnames_default()('block-editor-inserter__panel-header', 'block-editor-inserter__panel-header-patterns'); // In iOS-based mobile devices, the onBlur will fire when selecting an option + // from a Select element. To prevent closing the useDialog on iOS devices, we + // stop propagating the onBlur event if there is no relatedTarget, which means + // that the user most likely did not click on an element within the editor canvas. + + const onBlur = event => { + if (!(event !== null && event !== void 0 && event.relatedTarget)) { + event.stopPropagation(); + } + }; + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { + justify: "space-between", + align: "start", + gap: "4", + className: className + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, { + isBlock: true + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, { + className: "block-editor-inserter__panel-dropdown", + label: (0,external_wp_i18n_namespaceObject.__)('Filter patterns'), + hideLabelFromVision: true, + value: selectedCategory.name, + onChange: onChangeSelect, + onBlur: onBlur, + options: categoryOptions() + })), !isMobile && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + variant: "secondary", + className: "block-editor-inserter__patterns-explorer-expand", + label: (0,external_wp_i18n_namespaceObject.__)('Explore all patterns'), + onClick: () => openPatternExplorer() + }, (0,external_wp_i18n_namespaceObject._x)('Explore', 'Label for showing all block patterns')))); +} + +/* harmony default export */ var pattern_panel = (PatternInserterPanel); + +;// CONCATENATED MODULE: external ["wp","notices"] +var external_wp_notices_namespaceObject = window["wp"]["notices"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-patterns-state.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + +/** + * Retrieves the block patterns inserter state. + * + * @param {Function} onInsert function called when inserter a list of blocks. + * @param {string=} rootClientId Insertion's root client ID. + * + * @return {Array} Returns the patterns state. (patterns, categories, onSelect handler) + */ + +const usePatternsState = (onInsert, rootClientId) => { + const { + patternCategories, + patterns + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + __experimentalGetAllowedPatterns, + getSettings + } = select(store); + return { + patterns: __experimentalGetAllowedPatterns(rootClientId), + patternCategories: getSettings().__experimentalBlockPatternCategories + }; + }, [rootClientId]); + const { + createSuccessNotice + } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); + const onClickPattern = (0,external_wp_element_namespaceObject.useCallback)((pattern, blocks) => { + onInsert((0,external_lodash_namespaceObject.map)(blocks, block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block)), pattern.name); + createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %s: block pattern title. */ + (0,external_wp_i18n_namespaceObject.__)('Block pattern "%s" inserted.'), pattern.title), { + type: 'snackbar' + }); + }, []); + return [patterns, patternCategories, onClickPattern]; +}; + +/* harmony default export */ var use_patterns_state = (usePatternsState); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-patterns-list/index.js + + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + +function BlockPattern(_ref) { + let { + isDraggable, + pattern, + onClick, + composite + } = _ref; + const { + blocks, + viewportWidth + } = pattern; + const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockPattern); + const descriptionId = `block-editor-block-patterns-list__item-description-${instanceId}`; + return (0,external_wp_element_namespaceObject.createElement)(inserter_draggable_blocks, { + isEnabled: isDraggable, + blocks: blocks + }, _ref2 => { + let { + draggable, + onDragStart, + onDragEnd + } = _ref2; + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-patterns-list__list-item", + "aria-label": pattern.title, + "aria-describedby": pattern.description ? descriptionId : undefined, + draggable: draggable, + onDragStart: onDragStart, + onDragEnd: onDragEnd + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableCompositeItem, _extends({ + role: "option", + as: "div" + }, composite, { + className: "block-editor-block-patterns-list__item", + onClick: () => onClick(pattern, blocks) + }), (0,external_wp_element_namespaceObject.createElement)(block_preview, { + blocks: blocks, + viewportWidth: viewportWidth + }), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-patterns-list__item-title" + }, pattern.title), !!pattern.description && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { + id: descriptionId + }, pattern.description))); + }); +} + +function BlockPatternPlaceholder() { + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-patterns-list__item is-placeholder" + }); +} + +function BlockPatternList(_ref3) { + let { + isDraggable, + blockPatterns, + shownPatterns, + onClickPattern, + orientation, + label = (0,external_wp_i18n_namespaceObject.__)('Block Patterns') + } = _ref3; + const composite = (0,external_wp_components_namespaceObject.__unstableUseCompositeState)({ + orientation + }); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableComposite, _extends({}, composite, { + role: "listbox", + className: "block-editor-block-patterns-list", + "aria-label": label + }), blockPatterns.map(pattern => { + const isShown = shownPatterns.includes(pattern); + return isShown ? (0,external_wp_element_namespaceObject.createElement)(BlockPattern, { + key: pattern.name, + pattern: pattern, + onClick: onClickPattern, + isDraggable: isDraggable, + composite: composite + }) : (0,external_wp_element_namespaceObject.createElement)(BlockPatternPlaceholder, { + key: pattern.name + }); + })); +} + +/* harmony default export */ var block_patterns_list = (BlockPatternList); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/sidebar.js + + +/** + * WordPress dependencies + */ + + + +function PatternCategoriesList(_ref) { + let { + selectedCategory, + patternCategories, + onClickCategory + } = _ref; + const baseClassName = 'block-editor-block-patterns-explorer__sidebar'; + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: `${baseClassName}__categories-list` + }, patternCategories.map(_ref2 => { + let { + name, + label + } = _ref2; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + key: name, + label: label, + className: `${baseClassName}__categories-list__item`, + isPressed: selectedCategory === name, + onClick: () => { + onClickCategory(name); + } + }, label); + })); +} + +function PatternsExplorerSearch(_ref3) { + let { + filterValue, + setFilterValue + } = _ref3; + const baseClassName = 'block-editor-block-patterns-explorer__search'; + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: baseClassName + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SearchControl, { + onChange: setFilterValue, + value: filterValue, + label: (0,external_wp_i18n_namespaceObject.__)('Search for patterns'), + placeholder: (0,external_wp_i18n_namespaceObject.__)('Search') + })); +} + +function PatternExplorerSidebar(_ref4) { + let { + selectedCategory, + patternCategories, + onClickCategory, + filterValue, + setFilterValue + } = _ref4; + const baseClassName = 'block-editor-block-patterns-explorer__sidebar'; + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: baseClassName + }, (0,external_wp_element_namespaceObject.createElement)(PatternsExplorerSearch, { + filterValue: filterValue, + setFilterValue: setFilterValue + }), !filterValue && (0,external_wp_element_namespaceObject.createElement)(PatternCategoriesList, { + selectedCategory: selectedCategory, + patternCategories: patternCategories, + onClickCategory: onClickCategory + })); +} + +/* harmony default export */ var sidebar = (PatternExplorerSidebar); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/no-results.js + + +/** + * WordPress dependencies + */ + + + +function InserterNoResults() { + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-inserter__no-results" + }, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, { + className: "block-editor-inserter__no-results-icon", + icon: block_default + }), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('No results found.'))); +} + +/* harmony default export */ var no_results = (InserterNoResults); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-insertion-point.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + +/** + * @typedef WPInserterConfig + * + * @property {string=} rootClientId If set, insertion will be into the + * block with this ID. + * @property {number=} insertionIndex If set, insertion will be into this + * explicit position. + * @property {string=} clientId If set, insertion will be after the + * block with this ID. + * @property {boolean=} isAppender Whether the inserter is an appender + * or not. + * @property {Function=} onSelect Called after insertion. + */ + +/** + * Returns the insertion point state given the inserter config. + * + * @param {WPInserterConfig} config Inserter Config. + * @return {Array} Insertion Point State (rootClientID, onInsertBlocks and onToggle). + */ + +function useInsertionPoint(_ref) { + let { + rootClientId = '', + insertionIndex, + clientId, + isAppender, + onSelect, + shouldFocusBlock = true + } = _ref; + const { + getSelectedBlock + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const { + destinationRootClientId, + destinationIndex + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getSelectedBlockClientId, + getBlockRootClientId, + getBlockIndex, + getBlockOrder + } = select(store); + const selectedBlockClientId = getSelectedBlockClientId(); + let _destinationRootClientId = rootClientId; + + let _destinationIndex; + + if (insertionIndex !== undefined) { + // Insert into a specific index. + _destinationIndex = insertionIndex; + } else if (clientId) { + // Insert after a specific client ID. + _destinationIndex = getBlockIndex(clientId); + } else if (!isAppender && selectedBlockClientId) { + _destinationRootClientId = getBlockRootClientId(selectedBlockClientId); + _destinationIndex = getBlockIndex(selectedBlockClientId) + 1; + } else { + // Insert at the end of the list. + _destinationIndex = getBlockOrder(_destinationRootClientId).length; + } + + return { + destinationRootClientId: _destinationRootClientId, + destinationIndex: _destinationIndex + }; + }, [rootClientId, insertionIndex, clientId, isAppender]); + const { + replaceBlocks, + insertBlocks, + showInsertionPoint, + hideInsertionPoint + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const onInsertBlocks = (0,external_wp_element_namespaceObject.useCallback)(function (blocks, meta) { + let shouldForceFocusBlock = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + const selectedBlock = getSelectedBlock(); + + if (!isAppender && selectedBlock && (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(selectedBlock)) { + replaceBlocks(selectedBlock.clientId, blocks, null, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta); + } else { + insertBlocks(blocks, destinationIndex, destinationRootClientId, true, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta); + } + + const message = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: the name of the block that has been added + (0,external_wp_i18n_namespaceObject._n)('%d block added.', '%d blocks added.', (0,external_lodash_namespaceObject.castArray)(blocks).length), (0,external_lodash_namespaceObject.castArray)(blocks).length); + (0,external_wp_a11y_namespaceObject.speak)(message); + + if (onSelect) { + onSelect(); + } + }, [isAppender, getSelectedBlock, replaceBlocks, insertBlocks, destinationRootClientId, destinationIndex, onSelect, shouldFocusBlock]); + const onToggleInsertionPoint = (0,external_wp_element_namespaceObject.useCallback)(show => { + if (show) { + showInsertionPoint(destinationRootClientId, destinationIndex); + } else { + hideInsertionPoint(); + } + }, [showInsertionPoint, hideInsertionPoint, destinationRootClientId, destinationIndex]); + return [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint]; +} + +/* harmony default export */ var use_insertion_point = (useInsertionPoint); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/search-items.js +/** + * External dependencies + */ + // Default search helpers. + +const defaultGetName = item => item.name || ''; + +const defaultGetTitle = item => item.title; + +const defaultGetDescription = item => item.description || ''; + +const defaultGetKeywords = item => item.keywords || []; + +const defaultGetCategory = item => item.category; + +const defaultGetCollection = () => null; +/** + * Sanitizes the search input string. + * + * @param {string} input The search input to normalize. + * + * @return {string} The normalized search input. + */ + + +function normalizeSearchInput() { + let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + // Disregard diacritics. + // Input: "média" + input = (0,external_lodash_namespaceObject.deburr)(input); // Accommodate leading slash, matching autocomplete expectations. + // Input: "/media" + + input = input.replace(/^\//, ''); // Lowercase. + // Input: "MEDIA" + + input = input.toLowerCase(); + return input; +} +/** + * Converts the search term into a list of normalized terms. + * + * @param {string} input The search term to normalize. + * + * @return {string[]} The normalized list of search terms. + */ + + +const getNormalizedSearchTerms = function () { + let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + // Extract words. + return (0,external_lodash_namespaceObject.words)(normalizeSearchInput(input)); +}; + +const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => { + return (0,external_lodash_namespaceObject.differenceWith)(unmatchedTerms, getNormalizedSearchTerms(unprocessedTerms), (unmatchedTerm, unprocessedTerm) => unprocessedTerm.includes(unmatchedTerm)); +}; + +const searchBlockItems = (items, categories, collections, searchInput) => { + const normalizedSearchTerms = getNormalizedSearchTerms(searchInput); + + if (normalizedSearchTerms.length === 0) { + return items; + } + + const config = { + getCategory: item => { + var _find; + + return (_find = (0,external_lodash_namespaceObject.find)(categories, { + slug: item.category + })) === null || _find === void 0 ? void 0 : _find.title; + }, + getCollection: item => { + var _collections$item$nam; + + return (_collections$item$nam = collections[item.name.split('/')[0]]) === null || _collections$item$nam === void 0 ? void 0 : _collections$item$nam.title; + } + }; + return searchItems(items, searchInput, config); +}; +/** + * Filters an item list given a search term. + * + * @param {Array} items Item list + * @param {string} searchInput Search input. + * @param {Object} config Search Config. + * + * @return {Array} Filtered item list. + */ + +const searchItems = function () { + let items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + let searchInput = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + let config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + const normalizedSearchTerms = getNormalizedSearchTerms(searchInput); + + if (normalizedSearchTerms.length === 0) { + return items; + } + + const rankedItems = items.map(item => { + return [item, getItemSearchRank(item, searchInput, config)]; + }).filter(_ref => { + let [, rank] = _ref; + return rank > 0; + }); + rankedItems.sort((_ref2, _ref3) => { + let [, rank1] = _ref2; + let [, rank2] = _ref3; + return rank2 - rank1; + }); + return rankedItems.map(_ref4 => { + let [item] = _ref4; + return item; + }); +}; +/** + * Get the search rank for a given item and a specific search term. + * The better the match, the higher the rank. + * If the rank equals 0, it should be excluded from the results. + * + * @param {Object} item Item to filter. + * @param {string} searchTerm Search term. + * @param {Object} config Search Config. + * + * @return {number} Search Rank. + */ + +function getItemSearchRank(item, searchTerm) { + let config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + const { + getName = defaultGetName, + getTitle = defaultGetTitle, + getDescription = defaultGetDescription, + getKeywords = defaultGetKeywords, + getCategory = defaultGetCategory, + getCollection = defaultGetCollection + } = config; + const name = getName(item); + const title = getTitle(item); + const description = getDescription(item); + const keywords = getKeywords(item); + const category = getCategory(item); + const collection = getCollection(item); + const normalizedSearchInput = normalizeSearchInput(searchTerm); + const normalizedTitle = normalizeSearchInput(title); + let rank = 0; // Prefers exact matches + // Then prefers if the beginning of the title matches the search term + // name, keywords, categories, collection, variations match come later. + + if (normalizedSearchInput === normalizedTitle) { + rank += 30; + } else if (normalizedTitle.startsWith(normalizedSearchInput)) { + rank += 20; + } else { + const terms = [name, title, description, ...keywords, category, collection].join(' '); + const normalizedSearchTerms = (0,external_lodash_namespaceObject.words)(normalizedSearchInput); + const unmatchedTerms = removeMatchingTerms(normalizedSearchTerms, terms); + + if (unmatchedTerms.length === 0) { + rank += 10; + } + } // Give a better rank to "core" namespaced items. + + + if (rank !== 0 && name.startsWith('core/')) { + const isCoreBlockVariation = name !== item.id; // Give a bit better rank to "core" blocks over "core" block variations. + + rank += isCoreBlockVariation ? 1 : 2; + } + + return rank; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/patterns-list.js + + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + + + + + +const INITIAL_INSERTER_RESULTS = 2; + +function PatternsListHeader(_ref) { + let { + filterValue, + filteredBlockPatternsLength + } = _ref; + + if (!filterValue) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { + level: 2, + lineHeight: '48px', + className: "block-editor-block-patterns-explorer__search-results-count" + }, (0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %d: number of patterns. %s: block pattern search query */ + (0,external_wp_i18n_namespaceObject._n)('%1$d pattern found for "%2$s"', '%1$d patterns found for "%2$s"', filteredBlockPatternsLength), filteredBlockPatternsLength, filterValue)); +} + +function PatternList(_ref2) { + let { + filterValue, + selectedCategory, + patternCategories + } = _ref2; + const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); + const [destinationRootClientId, onInsertBlocks] = use_insertion_point({ + shouldFocusBlock: true + }); + const [allPatterns,, onSelectBlockPattern] = use_patterns_state(onInsertBlocks, destinationRootClientId); + const registeredPatternCategories = (0,external_wp_element_namespaceObject.useMemo)(() => patternCategories.map(patternCategory => patternCategory.name), [patternCategories]); + const filteredBlockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => { + if (!filterValue) { + return allPatterns.filter(pattern => { + var _pattern$categories, _pattern$categories2; + + return selectedCategory === 'uncategorized' ? !((_pattern$categories = pattern.categories) !== null && _pattern$categories !== void 0 && _pattern$categories.length) || pattern.categories.every(category => !registeredPatternCategories.includes(category)) : (_pattern$categories2 = pattern.categories) === null || _pattern$categories2 === void 0 ? void 0 : _pattern$categories2.includes(selectedCategory); + }); + } + + return searchItems(allPatterns, filterValue); + }, [filterValue, selectedCategory, allPatterns]); // Announce search results on change. + + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (!filterValue) { + return; + } + + const count = filteredBlockPatterns.length; + const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %d: number of results. */ + (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count); + debouncedSpeak(resultsFoundMessage); + }, [filterValue, debouncedSpeak]); + const currentShownPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(filteredBlockPatterns, { + step: INITIAL_INSERTER_RESULTS + }); + const hasItems = !!(filteredBlockPatterns !== null && filteredBlockPatterns !== void 0 && filteredBlockPatterns.length); + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-patterns-explorer__list" + }, hasItems && (0,external_wp_element_namespaceObject.createElement)(PatternsListHeader, { + filterValue: filterValue, + filteredBlockPatternsLength: filteredBlockPatterns.length + }), (0,external_wp_element_namespaceObject.createElement)(inserter_listbox, null, !hasItems && (0,external_wp_element_namespaceObject.createElement)(no_results, null), hasItems && (0,external_wp_element_namespaceObject.createElement)(block_patterns_list, { + shownPatterns: currentShownPatterns, + blockPatterns: filteredBlockPatterns, + onClickPattern: onSelectBlockPattern, + isDraggable: false + }))); +} + +/* harmony default export */ var patterns_list = (PatternList); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/explorer.js + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + +function PatternsExplorer(_ref) { + let { + initialCategory, + patternCategories + } = _ref; + const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(''); + const [selectedCategory, setSelectedCategory] = (0,external_wp_element_namespaceObject.useState)(initialCategory === null || initialCategory === void 0 ? void 0 : initialCategory.name); + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-patterns-explorer" + }, (0,external_wp_element_namespaceObject.createElement)(sidebar, { + selectedCategory: selectedCategory, + patternCategories: patternCategories, + onClickCategory: setSelectedCategory, + filterValue: filterValue, + setFilterValue: setFilterValue + }), (0,external_wp_element_namespaceObject.createElement)(patterns_list, { + filterValue: filterValue, + selectedCategory: selectedCategory, + patternCategories: patternCategories + })); +} + +function PatternsExplorerModal(_ref2) { + let { + onModalClose, + ...restProps + } = _ref2; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { + title: (0,external_wp_i18n_namespaceObject.__)('Patterns'), + closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), + onRequestClose: onModalClose, + isFullScreen: true + }, (0,external_wp_element_namespaceObject.createElement)(PatternsExplorer, restProps)); +} + +/* harmony default export */ var explorer = (PatternsExplorerModal); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab.js + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + + + +function BlockPatternsCategory(_ref) { + let { + rootClientId, + onInsert, + selectedCategory, + populatedCategories + } = _ref; + const [allPatterns,, onClick] = use_patterns_state(onInsert, rootClientId); + const getPatternIndex = (0,external_wp_element_namespaceObject.useCallback)(pattern => { + var _pattern$categories; + + if (!((_pattern$categories = pattern.categories) !== null && _pattern$categories !== void 0 && _pattern$categories.length)) { + return Infinity; + } + + const indexedCategories = populatedCategories.reduce((accumulator, _ref2, index) => { + let { + name + } = _ref2; + accumulator[name] = index; + return accumulator; + }, {}); + return Math.min(...pattern.categories.map(cat => indexedCategories[cat] !== undefined ? indexedCategories[cat] : Infinity)); + }, [populatedCategories]); + const currentCategoryPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => allPatterns.filter(pattern => { + var _pattern$categories2; + + return selectedCategory.name === 'uncategorized' ? getPatternIndex(pattern) === Infinity : (_pattern$categories2 = pattern.categories) === null || _pattern$categories2 === void 0 ? void 0 : _pattern$categories2.includes(selectedCategory.name); + }), [allPatterns, selectedCategory]); // Ordering the patterns is important for the async rendering. + + const orderedPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => { + return currentCategoryPatterns.sort((a, b) => { + return getPatternIndex(a) - getPatternIndex(b); + }); + }, [currentCategoryPatterns, getPatternIndex]); + const currentShownPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(orderedPatterns); + + if (!currentCategoryPatterns.length) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-inserter__panel-content" + }, (0,external_wp_element_namespaceObject.createElement)(block_patterns_list, { + shownPatterns: currentShownPatterns, + blockPatterns: currentCategoryPatterns, + onClickPattern: onClick, + label: selectedCategory.label, + orientation: "vertical", + isDraggable: true + })); +} + +function BlockPatternsTabs(_ref3) { + let { + rootClientId, + onInsert, + onClickCategory, + selectedCategory + } = _ref3; + const [showPatternsExplorer, setShowPatternsExplorer] = (0,external_wp_element_namespaceObject.useState)(false); + const [allPatterns, allCategories] = use_patterns_state(); + const hasRegisteredCategory = (0,external_wp_element_namespaceObject.useCallback)(pattern => { + if (!pattern.categories || !pattern.categories.length) { + return false; + } + + return pattern.categories.some(cat => allCategories.some(category => category.name === cat)); + }, [allCategories]); // Remove any empty categories. + + const populatedCategories = (0,external_wp_element_namespaceObject.useMemo)(() => { + const categories = allCategories.filter(category => allPatterns.some(pattern => { + var _pattern$categories3; + + return (_pattern$categories3 = pattern.categories) === null || _pattern$categories3 === void 0 ? void 0 : _pattern$categories3.includes(category.name); + })).sort((_ref4, _ref5) => { + let { + name: currentName + } = _ref4; + let { + name: nextName + } = _ref5; + + if (![currentName, nextName].includes('featured')) { + return 0; + } + + return currentName === 'featured' ? -1 : 1; + }); + + if (allPatterns.some(pattern => !hasRegisteredCategory(pattern)) && !categories.find(category => category.name === 'uncategorized')) { + categories.push({ + name: 'uncategorized', + label: (0,external_wp_i18n_namespaceObject._x)('Uncategorized') + }); + } + + return categories; + }, [allPatterns, allCategories]); + const patternCategory = selectedCategory ? selectedCategory : populatedCategories[0]; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(pattern_panel, { + selectedCategory: patternCategory, + patternCategories: populatedCategories, + onClickCategory: onClickCategory, + openPatternExplorer: () => setShowPatternsExplorer(true) + }), !showPatternsExplorer && (0,external_wp_element_namespaceObject.createElement)(BlockPatternsCategory, { + rootClientId: rootClientId, + onInsert: onInsert, + selectedCategory: patternCategory, + populatedCategories: populatedCategories + }), showPatternsExplorer && (0,external_wp_element_namespaceObject.createElement)(explorer, { + initialCategory: patternCategory, + patternCategories: populatedCategories, + onModalClose: () => setShowPatternsExplorer(false) + })); +} + +/* harmony default export */ var block_patterns_tab = (BlockPatternsTabs); + +;// CONCATENATED MODULE: external ["wp","url"] +var external_wp_url_namespaceObject = window["wp"]["url"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/reusable-blocks-tab.js + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + + + +function ReusableBlocksList(_ref) { + let { + onHover, + onInsert, + rootClientId + } = _ref; + const [items,,, onSelectItem] = use_block_types_state(rootClientId, onInsert); + const filteredItems = (0,external_wp_element_namespaceObject.useMemo)(() => { + return items.filter(_ref2 => { + let { + category + } = _ref2; + return category === 'reusable'; + }); + }, [items]); + + if (filteredItems.length === 0) { + return (0,external_wp_element_namespaceObject.createElement)(no_results, null); + } + + return (0,external_wp_element_namespaceObject.createElement)(panel, { + title: (0,external_wp_i18n_namespaceObject.__)('Reusable blocks') + }, (0,external_wp_element_namespaceObject.createElement)(block_types_list, { + items: filteredItems, + onSelect: onSelectItem, + onHover: onHover, + label: (0,external_wp_i18n_namespaceObject.__)('Reusable blocks') + })); +} // The unwrapped component is only exported for use by unit tests. + +/** + * List of reusable blocks shown in the "Reusable" tab of the inserter. + * + * @param {Object} props Component props. + * @param {?string} props.rootClientId Client id of block to insert into. + * @param {Function} props.onInsert Callback to run when item is inserted. + * @param {Function} props.onHover Callback to run when item is hovered. + * + * @return {WPComponent} The component. + */ + + +function ReusableBlocksTab(_ref3) { + let { + rootClientId, + onInsert, + onHover + } = _ref3; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(ReusableBlocksList, { + onHover: onHover, + onInsert: onInsert, + rootClientId: rootClientId + }), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-inserter__manage-reusable-blocks-container" + }, (0,external_wp_element_namespaceObject.createElement)("a", { + className: "block-editor-inserter__manage-reusable-blocks", + href: (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { + post_type: 'wp_block' + }) + }, (0,external_wp_i18n_namespaceObject.__)('Manage Reusable blocks')))); +} +/* harmony default export */ var reusable_blocks_tab = (ReusableBlocksTab); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-menu-extension/index.js +/** + * WordPress dependencies + */ + +const { + Fill: __unstableInserterMenuExtension, + Slot +} = (0,external_wp_components_namespaceObject.createSlotFill)('__unstableInserterMenuExtension'); +__unstableInserterMenuExtension.Slot = Slot; +/* harmony default export */ var inserter_menu_extension = (__unstableInserterMenuExtension); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/search-results.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + + + + + + + + + +const search_results_INITIAL_INSERTER_RESULTS = 9; +/** + * Shared reference to an empty array for cases where it is important to avoid + * returning a new array reference on every invocation and rerendering the component. + * + * @type {Array} + */ + +const search_results_EMPTY_ARRAY = []; + +function InserterSearchResults(_ref) { + let { + filterValue, + onSelect, + onHover, + rootClientId, + clientId, + isAppender, + __experimentalInsertionIndex, + maxBlockPatterns, + maxBlockTypes, + showBlockDirectory = false, + isDraggable = true, + shouldFocusBlock = true, + prioritizePatterns + } = _ref; + const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); + const [destinationRootClientId, onInsertBlocks] = use_insertion_point({ + onSelect, + rootClientId, + clientId, + isAppender, + insertionIndex: __experimentalInsertionIndex, + shouldFocusBlock + }); + const [blockTypes, blockTypeCategories, blockTypeCollections, onSelectBlockType] = use_block_types_state(destinationRootClientId, onInsertBlocks); + const [patterns,, onSelectBlockPattern] = use_patterns_state(onInsertBlocks, destinationRootClientId); + const filteredBlockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => { + if (maxBlockPatterns === 0) { + return []; + } + + const results = searchItems(patterns, filterValue); + return maxBlockPatterns !== undefined ? results.slice(0, maxBlockPatterns) : results; + }, [filterValue, patterns, maxBlockPatterns]); + let maxBlockTypesToShow = maxBlockTypes; + + if (prioritizePatterns && filteredBlockPatterns.length > 2) { + maxBlockTypesToShow = 0; + } + + const filteredBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { + if (maxBlockTypesToShow === 0) { + return []; + } + + const results = searchBlockItems((0,external_lodash_namespaceObject.orderBy)(blockTypes, ['frecency'], ['desc']), blockTypeCategories, blockTypeCollections, filterValue); + return maxBlockTypesToShow !== undefined ? results.slice(0, maxBlockTypesToShow) : results; + }, [filterValue, blockTypes, blockTypeCategories, blockTypeCollections, maxBlockTypes]); // Announce search results on change. + + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (!filterValue) { + return; + } + + const count = filteredBlockTypes.length + filteredBlockPatterns.length; + const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %d: number of results. */ + (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count); + debouncedSpeak(resultsFoundMessage); + }, [filterValue, debouncedSpeak]); + const currentShownBlockTypes = (0,external_wp_compose_namespaceObject.useAsyncList)(filteredBlockTypes, { + step: search_results_INITIAL_INSERTER_RESULTS + }); + const currentShownPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(currentShownBlockTypes.length === filteredBlockTypes.length ? filteredBlockPatterns : search_results_EMPTY_ARRAY); + const hasItems = !(0,external_lodash_namespaceObject.isEmpty)(filteredBlockTypes) || !(0,external_lodash_namespaceObject.isEmpty)(filteredBlockPatterns); + const blocksUI = !!filteredBlockTypes.length && (0,external_wp_element_namespaceObject.createElement)(panel, { + title: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_wp_i18n_namespaceObject.__)('Blocks')) + }, (0,external_wp_element_namespaceObject.createElement)(block_types_list, { + items: currentShownBlockTypes, + onSelect: onSelectBlockType, + onHover: onHover, + label: (0,external_wp_i18n_namespaceObject.__)('Blocks'), + isDraggable: isDraggable + })); + const patternsUI = !!filteredBlockPatterns.length && (0,external_wp_element_namespaceObject.createElement)(panel, { + title: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_wp_i18n_namespaceObject.__)('Block Patterns')) + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-inserter__quick-inserter-patterns" + }, (0,external_wp_element_namespaceObject.createElement)(block_patterns_list, { + shownPatterns: currentShownPatterns, + blockPatterns: filteredBlockPatterns, + onClickPattern: onSelectBlockPattern, + isDraggable: isDraggable + }))); + return (0,external_wp_element_namespaceObject.createElement)(inserter_listbox, null, !showBlockDirectory && !hasItems && (0,external_wp_element_namespaceObject.createElement)(no_results, null), prioritizePatterns ? patternsUI : blocksUI, !!filteredBlockTypes.length && !!filteredBlockPatterns.length && (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-inserter__quick-inserter-separator" + }), prioritizePatterns ? blocksUI : patternsUI, showBlockDirectory && (0,external_wp_element_namespaceObject.createElement)(inserter_menu_extension.Slot, { + fillProps: { + onSelect: onSelectBlockType, + onHover, + filterValue, + hasItems, + rootClientId: destinationRootClientId + } + }, fills => { + if (fills.length) { + return fills; + } + + if (!hasItems) { + return (0,external_wp_element_namespaceObject.createElement)(no_results, null); + } + + return null; + })); +} + +/* harmony default export */ var search_results = (InserterSearchResults); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/tabs.js + + +/** + * WordPress dependencies + */ + + + +const blocksTab = { + name: 'blocks', + + /* translators: Blocks tab title in the block inserter. */ + title: (0,external_wp_i18n_namespaceObject.__)('Blocks') +}; +const patternsTab = { + name: 'patterns', + + /* translators: Patterns tab title in the block inserter. */ + title: (0,external_wp_i18n_namespaceObject.__)('Patterns') +}; +const reusableBlocksTab = { + name: 'reusable', + + /* translators: Reusable blocks tab title in the block inserter. */ + title: (0,external_wp_i18n_namespaceObject.__)('Reusable') +}; + +function InserterTabs(_ref) { + let { + children, + showPatterns = false, + showReusableBlocks = false, + onSelect + } = _ref; + const tabs = (0,external_wp_element_namespaceObject.useMemo)(() => { + const tempTabs = [blocksTab]; + + if (showPatterns) { + tempTabs.push(patternsTab); + } + + if (showReusableBlocks) { + tempTabs.push(reusableBlocksTab); + } + + return tempTabs; + }, [blocksTab, showPatterns, patternsTab, showReusableBlocks, reusableBlocksTab]); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TabPanel, { + className: "block-editor-inserter__tabs", + tabs: tabs, + onSelect: onSelect + }, children); +} + +/* harmony default export */ var tabs = (InserterTabs); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/menu.js + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + + + + + + + + +function InserterMenu(_ref, ref) { + let { + rootClientId, + clientId, + isAppender, + __experimentalInsertionIndex, + onSelect, + showInserterHelpPanel, + showMostUsedBlocks, + __experimentalFilterValue = '', + shouldFocusBlock = true + } = _ref; + const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(__experimentalFilterValue); + const [hoveredItem, setHoveredItem] = (0,external_wp_element_namespaceObject.useState)(null); + const [selectedPatternCategory, setSelectedPatternCategory] = (0,external_wp_element_namespaceObject.useState)(null); + const [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint] = use_insertion_point({ + rootClientId, + clientId, + isAppender, + insertionIndex: __experimentalInsertionIndex, + shouldFocusBlock + }); + const { + showPatterns, + hasReusableBlocks + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + var _getSettings$__experi; + + const { + __experimentalGetAllowedPatterns, + getSettings + } = select(store); + return { + showPatterns: !!__experimentalGetAllowedPatterns(destinationRootClientId).length, + hasReusableBlocks: !!((_getSettings$__experi = getSettings().__experimentalReusableBlocks) !== null && _getSettings$__experi !== void 0 && _getSettings$__experi.length) + }; + }, [destinationRootClientId]); + const onInsert = (0,external_wp_element_namespaceObject.useCallback)((blocks, meta, shouldForceFocusBlock) => { + onInsertBlocks(blocks, meta, shouldForceFocusBlock); + onSelect(); + }, [onInsertBlocks, onSelect]); + const onInsertPattern = (0,external_wp_element_namespaceObject.useCallback)((blocks, patternName) => { + onInsertBlocks(blocks, { + patternName + }); + onSelect(); + }, [onInsertBlocks, onSelect]); + const onHover = (0,external_wp_element_namespaceObject.useCallback)(item => { + onToggleInsertionPoint(!!item); + setHoveredItem(item); + }, [onToggleInsertionPoint, setHoveredItem]); + const onClickPatternCategory = (0,external_wp_element_namespaceObject.useCallback)(patternCategory => { + setSelectedPatternCategory(patternCategory); + }, [setSelectedPatternCategory]); + const blocksTab = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-inserter__block-list" + }, (0,external_wp_element_namespaceObject.createElement)(block_types_tab, { rootClientId: destinationRootClientId, + onInsert: onInsert, + onHover: onHover, + showMostUsedBlocks: showMostUsedBlocks + })), showInserterHelpPanel && (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-inserter__tips" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { + as: "h2" + }, (0,external_wp_i18n_namespaceObject.__)('A tip for using the block editor')), (0,external_wp_element_namespaceObject.createElement)(tips, null))), [destinationRootClientId, onInsert, onHover, filterValue, showMostUsedBlocks, showInserterHelpPanel]); + const patternsTab = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_wp_element_namespaceObject.createElement)(block_patterns_tab, { + rootClientId: destinationRootClientId, + onInsert: onInsertPattern, + onClickCategory: onClickPatternCategory, + selectedCategory: selectedPatternCategory + }), [destinationRootClientId, onInsertPattern, onClickPatternCategory, selectedPatternCategory]); + const reusableBlocksTab = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_wp_element_namespaceObject.createElement)(reusable_blocks_tab, { + rootClientId: destinationRootClientId, + onInsert: onInsert, + onHover: onHover + }), [destinationRootClientId, onInsert, onHover]); + const getCurrentTab = (0,external_wp_element_namespaceObject.useCallback)(tab => { + if (tab.name === 'blocks') { + return blocksTab; + } else if (tab.name === 'patterns') { + return patternsTab; + } + + return reusableBlocksTab; + }, [blocksTab, patternsTab, reusableBlocksTab]); + const searchRef = (0,external_wp_element_namespaceObject.useRef)(); + (0,external_wp_element_namespaceObject.useImperativeHandle)(ref, () => ({ + focusSearch: () => { + searchRef.current.focus(); + } + })); + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-inserter__menu" + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-inserter__main-area" + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-inserter__content" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SearchControl, { + className: "block-editor-inserter__search", + onChange: value => { + if (hoveredItem) setHoveredItem(null); + setFilterValue(value); + }, + value: filterValue, + label: (0,external_wp_i18n_namespaceObject.__)('Search for blocks and patterns'), + placeholder: (0,external_wp_i18n_namespaceObject.__)('Search'), + ref: searchRef + }), !!filterValue && (0,external_wp_element_namespaceObject.createElement)(search_results, { + filterValue: filterValue, + onSelect: onSelect, + onHover: onHover, + rootClientId: rootClientId, + clientId: clientId, + isAppender: isAppender, + __experimentalInsertionIndex: __experimentalInsertionIndex, + showBlockDirectory: true, + shouldFocusBlock: shouldFocusBlock + }), !filterValue && (showPatterns || hasReusableBlocks) && (0,external_wp_element_namespaceObject.createElement)(tabs, { + showPatterns: showPatterns, + showReusableBlocks: hasReusableBlocks + }, getCurrentTab), !filterValue && !showPatterns && !hasReusableBlocks && blocksTab)), showInserterHelpPanel && hoveredItem && (0,external_wp_element_namespaceObject.createElement)(preview_panel, { + item: hoveredItem + })); +} + +/* harmony default export */ var menu = ((0,external_wp_element_namespaceObject.forwardRef)(InserterMenu)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/quick-inserter.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + + + + +const SEARCH_THRESHOLD = 6; +const SHOWN_BLOCK_TYPES = 6; +const SHOWN_BLOCK_PATTERNS = 2; +const SHOWN_BLOCK_PATTERNS_WITH_PRIORITIZATION = 4; +function QuickInserter(_ref) { + let { + onSelect, + rootClientId, + clientId, + isAppender, + prioritizePatterns + } = _ref; + const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(''); + const [destinationRootClientId, onInsertBlocks] = use_insertion_point({ + onSelect, + rootClientId, + clientId, + isAppender + }); + const [blockTypes] = use_block_types_state(destinationRootClientId, onInsertBlocks); + const [patterns] = use_patterns_state(onInsertBlocks, destinationRootClientId); + const { + setInserterIsOpened, + insertionIndex + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getSettings, + getBlockIndex, + getBlockCount + } = select(store); + const settings = getSettings(); + const index = getBlockIndex(clientId); + const blockCount = getBlockCount(); + return { + setInserterIsOpened: settings.__experimentalSetIsInserterOpened, + insertionIndex: index === -1 ? blockCount : index + }; + }, [clientId]); + const showPatterns = patterns.length && (!!filterValue || prioritizePatterns); + const showSearch = showPatterns && patterns.length > SEARCH_THRESHOLD || blockTypes.length > SEARCH_THRESHOLD; + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (setInserterIsOpened) { + setInserterIsOpened(false); + } + }, [setInserterIsOpened]); // When clicking Browse All select the appropriate block so as + // the insertion point can work as expected. + + const onBrowseAll = () => { + setInserterIsOpened({ + rootClientId, + insertionIndex, + filterValue + }); + }; + + let maxBlockPatterns = 0; + + if (showPatterns) { + maxBlockPatterns = prioritizePatterns ? SHOWN_BLOCK_PATTERNS_WITH_PRIORITIZATION : SHOWN_BLOCK_PATTERNS; + } + + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: classnames_default()('block-editor-inserter__quick-inserter', { + 'has-search': showSearch, + 'has-expand': setInserterIsOpened + }) + }, showSearch && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SearchControl, { + className: "block-editor-inserter__search", + value: filterValue, + onChange: value => { + setFilterValue(value); + }, + label: (0,external_wp_i18n_namespaceObject.__)('Search for blocks and patterns'), + placeholder: (0,external_wp_i18n_namespaceObject.__)('Search') + }), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-inserter__quick-inserter-results" + }, (0,external_wp_element_namespaceObject.createElement)(search_results, { + filterValue: filterValue, + onSelect: onSelect, + rootClientId: rootClientId, clientId: clientId, isAppender: isAppender, - showInserterHelpPanel: showInserterHelpPanel, - showMostUsedBlocks: showMostUsedBlocks, - __experimentalInsertionIndex: __experimentalInsertionIndex, - shouldFocusBlock: shouldFocusBlock - }); -} - -/* harmony default export */ var library = (InserterLibrary); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/keyboard-shortcuts/index.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - -function KeyboardShortcuts() { - // Shortcuts Logic + maxBlockPatterns: maxBlockPatterns, + maxBlockTypes: SHOWN_BLOCK_TYPES, + isDraggable: false, + prioritizePatterns: prioritizePatterns + })), setInserterIsOpened && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + className: "block-editor-inserter__quick-inserter-expand", + onClick: onBrowseAll, + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Browse all. This will open the main inserter panel in the editor toolbar.') + }, (0,external_wp_i18n_namespaceObject.__)('Browse all'))); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/index.js + + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + + + + + +/** + * Internal dependencies + */ + + + + + +const defaultRenderToggle = _ref => { + let { + onToggle, + disabled, + isOpen, + blockTitle, + hasSingleBlockType, + toggleProps = {}, + prioritizePatterns + } = _ref; + let label; + + if (hasSingleBlockType) { + label = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name of the block when there is only one + (0,external_wp_i18n_namespaceObject._x)('Add %s', 'directly add the only allowed block'), blockTitle); + } else if (prioritizePatterns) { + label = (0,external_wp_i18n_namespaceObject.__)('Add pattern'); + } else { + label = (0,external_wp_i18n_namespaceObject._x)('Add block', 'Generic label for block inserter button'); + } + + const { + onClick, + ...rest + } = toggleProps; // Handle both onClick functions from the toggle and the parent component. + + function handleClick(event) { + if (onToggle) { + onToggle(event); + } + + if (onClick) { + onClick(event); + } + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({ + icon: library_plus, + label: label, + tooltipPosition: "bottom", + onClick: handleClick, + className: "block-editor-inserter__toggle", + "aria-haspopup": !hasSingleBlockType ? 'true' : false, + "aria-expanded": !hasSingleBlockType ? isOpen : false, + disabled: disabled + }, rest)); +}; + +class Inserter extends external_wp_element_namespaceObject.Component { + constructor() { + super(...arguments); + this.onToggle = this.onToggle.bind(this); + this.renderToggle = this.renderToggle.bind(this); + this.renderContent = this.renderContent.bind(this); + } + + onToggle(isOpen) { + const { + onToggle + } = this.props; // Surface toggle callback to parent component. + + if (onToggle) { + onToggle(isOpen); + } + } + /** + * Render callback to display Dropdown toggle element. + * + * @param {Object} options + * @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. + */ + + + renderToggle(_ref2) { + let { + onToggle, + isOpen + } = _ref2; + const { + disabled, + blockTitle, + hasSingleBlockType, + directInsertBlock, + toggleProps, + hasItems, + renderToggle = defaultRenderToggle, + prioritizePatterns + } = this.props; + return renderToggle({ + onToggle, + isOpen, + disabled: disabled || !hasItems, + blockTitle, + hasSingleBlockType, + directInsertBlock, + toggleProps, + prioritizePatterns + }); + } + /** + * Render callback to display Dropdown content element. + * + * @param {Object} options + * @param {Function} options.onClose Callback to invoke when dropdown is + * closed. + * + * @return {WPElement} Dropdown content element. + */ + + + renderContent(_ref3) { + let { + onClose + } = _ref3; + const { + rootClientId, + clientId, + isAppender, + showInserterHelpPanel, + // This prop is experimental to give some time for the quick inserter to mature + // Feel free to make them stable after a few releases. + __experimentalIsQuick: isQuick, + prioritizePatterns + } = this.props; + + if (isQuick) { + return (0,external_wp_element_namespaceObject.createElement)(QuickInserter, { + onSelect: () => { + onClose(); + }, + rootClientId: rootClientId, + clientId: clientId, + isAppender: isAppender, + prioritizePatterns: prioritizePatterns + }); + } + + return (0,external_wp_element_namespaceObject.createElement)(menu, { + onSelect: () => { + onClose(); + }, + rootClientId: rootClientId, + clientId: clientId, + isAppender: isAppender, + showInserterHelpPanel: showInserterHelpPanel + }); + } + + render() { + const { + position, + hasSingleBlockType, + directInsertBlock, + insertOnlyAllowedBlock, + __experimentalIsQuick: isQuick, + onSelectOrClose + } = this.props; + + if (hasSingleBlockType || directInsertBlock) { + return this.renderToggle({ + onToggle: insertOnlyAllowedBlock + }); + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { + className: "block-editor-inserter", + contentClassName: classnames_default()('block-editor-inserter__popover', { + 'is-quick': isQuick + }), + position: position, + onToggle: this.onToggle, + expandOnMobile: true, + headerTitle: (0,external_wp_i18n_namespaceObject.__)('Add a block'), + renderToggle: this.renderToggle, + renderContent: this.renderContent, + onClose: onSelectOrClose + }); + } + +} + +/* harmony default export */ var inserter = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, _ref4) => { + let { + clientId, + rootClientId + } = _ref4; + const { + getBlockRootClientId, + hasInserterItems, + __experimentalGetAllowedBlocks, + __experimentalGetDirectInsertBlock, + getBlockIndex, + getBlockCount, + getSettings + } = select(store); + const { + getBlockVariations + } = select(external_wp_blocks_namespaceObject.store); + rootClientId = rootClientId || getBlockRootClientId(clientId) || undefined; + + const allowedBlocks = __experimentalGetAllowedBlocks(rootClientId); + + const directInsertBlock = __experimentalGetDirectInsertBlock(rootClientId); + + const index = getBlockIndex(clientId); + const blockCount = getBlockCount(); + const settings = getSettings(); + const hasSingleBlockType = (0,external_lodash_namespaceObject.size)(allowedBlocks) === 1 && (0,external_lodash_namespaceObject.size)(getBlockVariations(allowedBlocks[0].name, 'inserter')) === 0; + let allowedBlockType = false; + + if (hasSingleBlockType) { + allowedBlockType = allowedBlocks[0]; + } + + return { + hasItems: hasInserterItems(rootClientId), + hasSingleBlockType, + blockTitle: allowedBlockType ? allowedBlockType.title : '', + allowedBlockType, + directInsertBlock, + rootClientId, + prioritizePatterns: settings.__experimentalPreferPatternsOnRoot && !rootClientId && index > 0 && (index < blockCount || blockCount === 0) + }; +}), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, _ref5) => { + let { + select + } = _ref5; + return { + insertOnlyAllowedBlock() { + const { + rootClientId, + clientId, + isAppender, + hasSingleBlockType, + allowedBlockType, + directInsertBlock, + onSelectOrClose + } = ownProps; + + if (!hasSingleBlockType && !directInsertBlock) { + return; + } + + function getAdjacentBlockAttributes(attributesToCopy) { + const { + getBlock, + getPreviousBlockClientId + } = select(store); + + if (!attributesToCopy || !clientId && !rootClientId) { + return {}; + } + + const result = {}; + let adjacentAttributes = {}; // If there is no clientId, then attempt to get attributes + // from the last block within innerBlocks of the root block. + + if (!clientId) { + var _parentBlock$innerBlo; + + const parentBlock = getBlock(rootClientId); + + if (parentBlock !== null && parentBlock !== void 0 && (_parentBlock$innerBlo = parentBlock.innerBlocks) !== null && _parentBlock$innerBlo !== void 0 && _parentBlock$innerBlo.length) { + const lastInnerBlock = parentBlock.innerBlocks[parentBlock.innerBlocks.length - 1]; + + if (directInsertBlock && (directInsertBlock === null || directInsertBlock === void 0 ? void 0 : directInsertBlock.name) === lastInnerBlock.name) { + adjacentAttributes = lastInnerBlock.attributes; + } + } + } else { + // Otherwise, attempt to get attributes from the + // previous block relative to the current clientId. + const currentBlock = getBlock(clientId); + const previousBlock = getBlock(getPreviousBlockClientId(clientId)); + + if ((currentBlock === null || currentBlock === void 0 ? void 0 : currentBlock.name) === (previousBlock === null || previousBlock === void 0 ? void 0 : previousBlock.name)) { + adjacentAttributes = (previousBlock === null || previousBlock === void 0 ? void 0 : previousBlock.attributes) || {}; + } + } // Copy over only those attributes flagged to be copied. + + + attributesToCopy.forEach(attribute => { + if (adjacentAttributes.hasOwnProperty(attribute)) { + result[attribute] = adjacentAttributes[attribute]; + } + }); + return result; + } + + function getInsertionIndex() { + const { + getBlockIndex, + getBlockSelectionEnd, + getBlockOrder, + getBlockRootClientId + } = select(store); // If the clientId is defined, we insert at the position of the block. + + if (clientId) { + return getBlockIndex(clientId); + } // If there a selected block, we insert after the selected block. + + + const end = getBlockSelectionEnd(); + + if (!isAppender && end && getBlockRootClientId(end) === rootClientId) { + return getBlockIndex(end) + 1; + } // Otherwise, we insert at the end of the current rootClientId. + + + return getBlockOrder(rootClientId).length; + } + + const { + insertBlock + } = dispatch(store); + let blockToInsert; // Attempt to augment the directInsertBlock with attributes from an adjacent block. + // This ensures styling from nearby blocks is preserved in the newly inserted block. + // See: https://github.com/WordPress/gutenberg/issues/37904 + + if (directInsertBlock) { + const newAttributes = getAdjacentBlockAttributes(directInsertBlock.attributesToCopy); + blockToInsert = (0,external_wp_blocks_namespaceObject.createBlock)(directInsertBlock.name, { ...(directInsertBlock.attributes || {}), + ...newAttributes + }); + } else { + blockToInsert = (0,external_wp_blocks_namespaceObject.createBlock)(allowedBlockType.name); + } + + insertBlock(blockToInsert, getInsertionIndex(), rootClientId); + + if (onSelectOrClose) { + onSelectOrClose(); + } + + const message = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name of the block that has been added + (0,external_wp_i18n_namespaceObject.__)('%s block added'), allowedBlockType.title); + (0,external_wp_a11y_namespaceObject.speak)(message); + } + + }; +}), // The global inserter should always be visible, we are using ( ! isAppender && ! rootClientId && ! clientId ) as +// a way to detect the global Inserter. +(0,external_wp_compose_namespaceObject.ifCondition)(_ref6 => { + let { + hasItems, + isAppender, + rootClientId, + clientId + } = _ref6; + return hasItems || !isAppender && !rootClientId && !clientId; +})])(Inserter)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/default-block-appender/index.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + +/** + * Zero width non-breaking space, used as padding for the paragraph when it is + * empty. + */ + +const ZWNBSP = '\ufeff'; +function DefaultBlockAppender(_ref) { + let { + isLocked, + onAppend, + showPrompt, + placeholder, + rootClientId + } = _ref; + + if (isLocked) { + return null; + } + + const value = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)('Type / to choose a block'); + + return (0,external_wp_element_namespaceObject.createElement)("div", { + "data-root-client-id": rootClientId || '', + className: classnames_default()('block-editor-default-block-appender', { + 'has-visible-prompt': showPrompt + }) + }, (0,external_wp_element_namespaceObject.createElement)("p", { + tabIndex: "0" // We want this element to be styled as a paragraph by themes. + // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role + , + role: "button", + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Add default block') // A wrapping container for this one already has the wp-block className. + , + className: "block-editor-default-block-appender__content", + onKeyDown: event => { + if (external_wp_keycodes_namespaceObject.ENTER === event.keyCode || external_wp_keycodes_namespaceObject.SPACE === event.keyCode) { + onAppend(); + } + }, + onClick: () => onAppend(), + onFocus: () => { + if (showPrompt) { + onAppend(); + } + } + }, showPrompt ? value : ZWNBSP), (0,external_wp_element_namespaceObject.createElement)(inserter, { + rootClientId: rootClientId, + position: "bottom right", + isAppender: true, + __experimentalIsQuick: true + })); +} +/* harmony default export */ var default_block_appender = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => { + const { + getBlockCount, + getSettings, + getTemplateLock + } = select(store); + const isEmpty = !getBlockCount(ownProps.rootClientId); + const { + bodyPlaceholder + } = getSettings(); + return { + showPrompt: isEmpty, + isLocked: !!getTemplateLock(ownProps.rootClientId), + placeholder: bodyPlaceholder + }; +}), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps) => { + const { + insertDefaultBlock, + startTyping + } = dispatch(store); + return { + onAppend() { + const { + rootClientId + } = ownProps; + insertDefaultBlock(undefined, rootClientId); + startTyping(); + } + + }; +}))(DefaultBlockAppender)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/button-block-appender/index.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + +function ButtonBlockAppender(_ref, ref) { + let { + rootClientId, + className, + onFocus, + tabIndex + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)(inserter, { + position: "bottom center", + rootClientId: rootClientId, + __experimentalIsQuick: true, + renderToggle: _ref2 => { + let { + onToggle, + disabled, + isOpen, + blockTitle, + hasSingleBlockType + } = _ref2; + let label; + + if (hasSingleBlockType) { + label = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name of the block when there is only one + (0,external_wp_i18n_namespaceObject._x)('Add %s', 'directly add the only allowed block'), blockTitle); + } else { + label = (0,external_wp_i18n_namespaceObject._x)('Add block', 'Generic label for block inserter button'); + } + + const isToggleButton = !hasSingleBlockType; + let inserterButton = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + ref: ref, + onFocus: onFocus, + tabIndex: tabIndex, + className: classnames_default()(className, 'block-editor-button-block-appender'), + onClick: onToggle, + "aria-haspopup": isToggleButton ? 'true' : undefined, + "aria-expanded": isToggleButton ? isOpen : undefined, + disabled: disabled, + label: label + }, !hasSingleBlockType && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { + as: "span" + }, label), (0,external_wp_element_namespaceObject.createElement)(build_module_icon, { + icon: library_plus + })); + + if (isToggleButton || hasSingleBlockType) { + inserterButton = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Tooltip, { + text: label + }, inserterButton); + } + + return inserterButton; + }, + isAppender: true + }); +} +/** + * Use `ButtonBlockAppender` instead. + * + * @deprecated + */ + + +const ButtonBlockerAppender = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { + external_wp_deprecated_default()(`wp.blockEditor.ButtonBlockerAppender`, { + alternative: 'wp.blockEditor.ButtonBlockAppender', + since: '5.9' + }); + return ButtonBlockAppender(props, ref); +}); +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/button-block-appender/README.md + */ + +/* harmony default export */ var button_block_appender = ((0,external_wp_element_namespaceObject.forwardRef)(ButtonBlockAppender)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list-appender/index.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + + +function BlockListAppender(_ref) { + let { + rootClientId, + canInsertDefaultBlock, + isLocked, + renderAppender: CustomAppender, + className, + selectedBlockClientId, + tagName: TagName = 'div' + } = _ref; + + if (isLocked || CustomAppender === false) { + return null; + } + + let appender; + + if (CustomAppender) { + // Prefer custom render prop if provided. + appender = (0,external_wp_element_namespaceObject.createElement)(CustomAppender, null); + } else { + const isParentSelected = selectedBlockClientId === rootClientId || !rootClientId && !selectedBlockClientId; + + if (!isParentSelected) { + return null; + } + + if (canInsertDefaultBlock) { + // Render the default block appender when renderAppender has not been + // provided and the context supports use of the default appender. + appender = (0,external_wp_element_namespaceObject.createElement)(default_block_appender, { + rootClientId: rootClientId + }); + } else { + // Fallback in the case no renderAppender has been provided and the + // default block can't be inserted. + appender = (0,external_wp_element_namespaceObject.createElement)(button_block_appender, { + rootClientId: rootClientId, + className: "block-list-appender__toggle" + }); + } + } + + return (0,external_wp_element_namespaceObject.createElement)(TagName // A `tabIndex` is used on the wrapping `div` element in order to + // force a focus event to occur when an appender `button` element + // is clicked. In some browsers (Firefox, Safari), button clicks do + // not emit a focus event, which could cause this event to propagate + // unexpectedly. The `tabIndex` ensures that the interaction is + // captured as a focus, without also adding an extra tab stop. + // + // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus + , { + tabIndex: -1, + className: classnames_default()('block-list-appender wp-block', className) // Needed in case the whole editor is content editable (for multi + // selection). It fixes an edge case where ArrowDown and ArrowRight + // should collapse the selection to the end of that selection and + // not into the appender. + , + contentEditable: false // The appender exists to let you add the first Paragraph before + // any is inserted. To that end, this appender should visually be + // presented as a block. That means theme CSS should style it as if + // it were an empty paragraph block. That means a `wp-block` class to + // ensure the width is correct, and a [data-block] attribute to ensure + // the correct margin is applied, especially for classic themes which + // have commonly targeted that attribute for margins. + , + "data-block": true + }, appender); +} + +/* harmony default export */ var block_list_appender = ((0,external_wp_data_namespaceObject.withSelect)((select, _ref2) => { + let { + rootClientId + } = _ref2; + const { + canInsertBlockType, + getTemplateLock, + getSelectedBlockClientId + } = select(store); + return { + isLocked: !!getTemplateLock(rootClientId), + canInsertDefaultBlock: canInsertBlockType((0,external_wp_blocks_namespaceObject.getDefaultBlockName)(), rootClientId), + selectedBlockClientId: getSelectedBlockClientId() + }; +})(BlockListAppender)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/use-popover-scroll.js +/** + * WordPress dependencies + */ + +/** + * Allow scrolling "through" popovers over the canvas. This is only called for + * as long as the pointer is over a popover. Do not use React events because it + * will bubble through portals. + * + * @param {Object} scrollableRef + */ + +function usePopoverScroll(scrollableRef) { + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { + if (!scrollableRef) { + return; + } + + function onWheel(event) { + const { + deltaX, + deltaY + } = event; + scrollableRef.current.scrollBy(deltaX, deltaY); + } // Tell the browser that we do not call event.preventDefault + // See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners + + + const options = { + passive: true + }; + node.addEventListener('wheel', onWheel, options); + return () => { + node.removeEventListener('wheel', onWheel, options); + }; + }, [scrollableRef]); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/insertion-point.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + + + +const InsertionPointOpenRef = (0,external_wp_element_namespaceObject.createContext)(); + +function InsertionPointPopover(_ref) { + let { + __unstablePopoverSlot, + __unstableContentRef + } = _ref; + const { + selectBlock, + hideInsertionPoint + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const openRef = (0,external_wp_element_namespaceObject.useContext)(InsertionPointOpenRef); + const ref = (0,external_wp_element_namespaceObject.useRef)(); + const { + orientation, + previousClientId, + nextClientId, + rootClientId, + isInserterShown + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + var _getBlockListSettings; + + const { + getBlockOrder, + getBlockListSettings, + getBlockInsertionPoint, + isBlockBeingDragged, + getPreviousBlockClientId, + getNextBlockClientId + } = select(store); + const insertionPoint = getBlockInsertionPoint(); + const order = getBlockOrder(insertionPoint.rootClientId); + + if (!order.length) { + return {}; + } + + let _previousClientId = order[insertionPoint.index - 1]; + let _nextClientId = order[insertionPoint.index]; + + while (isBlockBeingDragged(_previousClientId)) { + _previousClientId = getPreviousBlockClientId(_previousClientId); + } + + while (isBlockBeingDragged(_nextClientId)) { + _nextClientId = getNextBlockClientId(_nextClientId); + } + + return { + previousClientId: _previousClientId, + nextClientId: _nextClientId, + orientation: ((_getBlockListSettings = getBlockListSettings(insertionPoint.rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation) || 'vertical', + rootClientId: insertionPoint.rootClientId, + isInserterShown: insertionPoint === null || insertionPoint === void 0 ? void 0 : insertionPoint.__unstableWithInserter + }; + }, []); + const previousElement = useBlockElement(previousClientId); + const nextElement = useBlockElement(nextClientId); + const isVertical = orientation === 'vertical'; + const style = (0,external_wp_element_namespaceObject.useMemo)(() => { + if (!previousElement && !nextElement) { + return {}; + } + + const previousRect = previousElement ? previousElement.getBoundingClientRect() : null; + const nextRect = nextElement ? nextElement.getBoundingClientRect() : null; + + if (isVertical) { + return { + width: previousElement ? previousElement.offsetWidth : nextElement.offsetWidth, + height: nextRect && previousRect ? nextRect.top - previousRect.bottom : 0 + }; + } + + let width = 0; + + if (previousRect && nextRect) { + width = (0,external_wp_i18n_namespaceObject.isRTL)() ? previousRect.left - nextRect.right : nextRect.left - previousRect.right; + } + + return { + width, + height: previousElement ? previousElement.offsetHeight : nextElement.offsetHeight + }; + }, [previousElement, nextElement]); + const getAnchorRect = (0,external_wp_element_namespaceObject.useCallback)(() => { + if (!previousElement && !nextElement) { + return {}; + } + + const { + ownerDocument + } = previousElement || nextElement; + const previousRect = previousElement ? previousElement.getBoundingClientRect() : null; + const nextRect = nextElement ? nextElement.getBoundingClientRect() : null; + + if (isVertical) { + if ((0,external_wp_i18n_namespaceObject.isRTL)()) { + return { + top: previousRect ? previousRect.bottom : nextRect.top, + left: previousRect ? previousRect.right : nextRect.right, + right: previousRect ? previousRect.left : nextRect.left, + bottom: nextRect ? nextRect.top : previousRect.bottom, + ownerDocument + }; + } + + return { + top: previousRect ? previousRect.bottom : nextRect.top, + left: previousRect ? previousRect.left : nextRect.left, + right: previousRect ? previousRect.right : nextRect.right, + bottom: nextRect ? nextRect.top : previousRect.bottom, + ownerDocument + }; + } + + if ((0,external_wp_i18n_namespaceObject.isRTL)()) { + return { + top: previousRect ? previousRect.top : nextRect.top, + left: previousRect ? previousRect.left : nextRect.right, + right: nextRect ? nextRect.right : previousRect.left, + bottom: previousRect ? previousRect.bottom : nextRect.bottom, + ownerDocument + }; + } + + return { + top: previousRect ? previousRect.top : nextRect.top, + left: previousRect ? previousRect.right : nextRect.left, + right: nextRect ? nextRect.left : previousRect.right, + bottom: previousRect ? previousRect.bottom : nextRect.bottom, + ownerDocument + }; + }, [previousElement, nextElement]); + const popoverScrollRef = usePopoverScroll(__unstableContentRef); + const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); + const className = classnames_default()('block-editor-block-list__insertion-point', 'is-' + orientation); + + function onClick(event) { + if (event.target === ref.current && nextClientId) { + selectBlock(nextClientId, -1); + } + } + + function onFocus(event) { + // Only handle click on the wrapper specifically, and not an event + // bubbled from the inserter itself. + if (event.target !== ref.current) { + openRef.current = true; + } + } + + function maybeHideInserterPoint(event) { + // Only hide the inserter if it's triggered on the wrapper, + // and the inserter is not open. + if (event.target === ref.current && !openRef.current) { + hideInsertionPoint(); + } + } // Only show the in-between inserter between blocks, so when there's a + // previous and a next element. + + + const showInsertionPointInserter = previousElement && nextElement && isInserterShown; // Define animation variants for the line element. + + const horizontalLine = { + start: { + width: 0, + top: '50%', + bottom: '50%', + x: 0 + }, + rest: { + width: 4, + top: 0, + bottom: 0, + x: -2 + }, + hover: { + width: 4, + top: 0, + bottom: 0, + x: -2 + } + }; + const verticalLine = { + start: { + height: 0, + left: '50%', + right: '50%', + y: 0 + }, + rest: { + height: 4, + left: 0, + right: 0, + y: -2 + }, + hover: { + height: 4, + left: 0, + right: 0, + y: -2 + } + }; + const lineVariants = { + // Initial position starts from the center and invisible. + start: { ...(!isVertical ? horizontalLine.start : verticalLine.start), + opacity: 0 + }, + // The line expands to fill the container. If the inserter is visible it + // is delayed so it appears orchestrated. + rest: { ...(!isVertical ? horizontalLine.rest : verticalLine.rest), + opacity: 1, + borderRadius: '2px', + transition: { + delay: showInsertionPointInserter ? 0.4 : 0 + } + }, + hover: { ...(!isVertical ? horizontalLine.hover : verticalLine.hover), + opacity: 1, + borderRadius: '2px', + transition: { + delay: 0.4 + } + } + }; + const inserterVariants = { + start: { + scale: disableMotion ? 1 : 0 + }, + rest: { + scale: 1, + transition: { + delay: 0.2 + } + } + }; + /* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */ + // 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 + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, { + ref: popoverScrollRef, + noArrow: true, + animate: false, + getAnchorRect: getAnchorRect, + focusOnMount: false, + className: "block-editor-block-list__insertion-point-popover" // Render in the old slot if needed for backward compatibility, + // otherwise render in place (not in the the default popover slot). + , + __unstableSlotName: __unstablePopoverSlot || null // Forces a remount of the popover when its position changes + // This makes sure the popover doesn't animate from its previous position. + , + key: nextClientId + '--' + rootClientId + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { + layout: !disableMotion, + initial: disableMotion ? 'rest' : 'start', + animate: "rest", + whileHover: "hover", + whileTap: "pressed", + exit: "start", + ref: ref, + tabIndex: -1, + onClick: onClick, + onFocus: onFocus, + className: classnames_default()(className, { + 'is-with-inserter': showInsertionPointInserter + }), + onHoverEnd: maybeHideInserterPoint, + style: style + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { + variants: lineVariants, + className: "block-editor-block-list__insertion-point-indicator" + }), showInsertionPointInserter && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { + variants: inserterVariants, + className: classnames_default()('block-editor-block-list__insertion-point-inserter') + }, (0,external_wp_element_namespaceObject.createElement)(inserter, { + position: "bottom center", + clientId: nextClientId, + rootClientId: rootClientId, + __experimentalIsQuick: true, + onToggle: isOpen => { + openRef.current = isOpen; + }, + onSelectOrClose: () => { + openRef.current = false; + } + })))); + /* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */ +} + +function InsertionPoint(_ref2) { + let { + children, + __unstablePopoverSlot, + __unstableContentRef + } = _ref2; + const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => { + return select(store).isBlockInsertionPointVisible(); + }, []); + return (0,external_wp_element_namespaceObject.createElement)(InsertionPointOpenRef.Provider, { + value: (0,external_wp_element_namespaceObject.useRef)(false) + }, isVisible && (0,external_wp_element_namespaceObject.createElement)(InsertionPointPopover, { + __unstablePopoverSlot: __unstablePopoverSlot, + __unstableContentRef: __unstableContentRef + }), children); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-in-between-inserter.js +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + +function useInBetweenInserter() { + const openRef = (0,external_wp_element_namespaceObject.useContext)(InsertionPointOpenRef); + const hasReducedUI = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().hasReducedUI, []); + const { + getBlockListSettings, + getBlockRootClientId, + getBlockIndex, + isBlockInsertionPointVisible, + isMultiSelecting, + getSelectedBlockClientIds, + getTemplateLock + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const { + showInsertionPoint, + hideInsertionPoint + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { + if (hasReducedUI) { + return; + } + + function onMouseMove(event) { + var _getBlockListSettings, _element$parentElemen; + + if (openRef.current) { + return; + } + + if (isMultiSelecting()) { + return; + } + + if (!event.target.classList.contains('block-editor-block-list__layout')) { + if (isBlockInsertionPointVisible()) { + hideInsertionPoint(); + } + + return; + } + + let rootClientId; + + if (!event.target.classList.contains('is-root-container')) { + const blockElement = !!event.target.getAttribute('data-block') ? event.target : event.target.closest('[data-block]'); + rootClientId = blockElement.getAttribute('data-block'); + } // Don't set the insertion point if the template is locked. + + + if (getTemplateLock(rootClientId)) { + return; + } + + const orientation = ((_getBlockListSettings = getBlockListSettings(rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation) || 'vertical'; + const rect = event.target.getBoundingClientRect(); + const offsetTop = event.clientY - rect.top; + const offsetLeft = event.clientX - rect.left; + const children = Array.from(event.target.children); + let element = children.find(blockEl => { + return blockEl.classList.contains('wp-block') && orientation === 'vertical' && blockEl.offsetTop > offsetTop || blockEl.classList.contains('wp-block') && orientation === 'horizontal' && blockEl.offsetLeft > offsetLeft; + }); + + if (!element) { + return; + } // The block may be in an alignment wrapper, so check the first direct + // child if the element has no ID. + + + if (!element.id) { + element = element.firstElementChild; + + if (!element) { + return; + } + } // Don't show the insertion point if a parent block has an "overlay" + // See https://github.com/WordPress/gutenberg/pull/34012#pullrequestreview-727762337 + + + const parentOverlay = (_element$parentElemen = element.parentElement) === null || _element$parentElemen === void 0 ? void 0 : _element$parentElemen.closest('.block-editor-block-content-overlay.overlay-active'); + + if (parentOverlay) { + return; + } + + const clientId = element.id.slice('block-'.length); + + if (!clientId) { + return; + } // Don't show the inserter when hovering above (conflicts with + // block toolbar) or inside selected block(s). + + + if (getSelectedBlockClientIds().includes(clientId)) { + return; + } + + const elementRect = element.getBoundingClientRect(); + + if (orientation === 'horizontal' && (event.clientY > elementRect.bottom || event.clientY < elementRect.top) || orientation === 'vertical' && (event.clientX > elementRect.right || event.clientX < elementRect.left)) { + if (isBlockInsertionPointVisible()) { + hideInsertionPoint(); + } + + return; + } + + const index = getBlockIndex(clientId); // Don't show the in-between inserter before the first block in + // the list (preserves the original behaviour). + + if (index === 0) { + if (isBlockInsertionPointVisible()) { + hideInsertionPoint(); + } + + return; + } + + showInsertionPoint(rootClientId, index, { + __unstableWithInserter: true + }); + } + + node.addEventListener('mousemove', onMouseMove); + return () => { + node.removeEventListener('mousemove', onMouseMove); + }; + }, [openRef, getBlockListSettings, getBlockRootClientId, getBlockIndex, isBlockInsertionPointVisible, isMultiSelecting, showInsertionPoint, hideInsertionPoint, getSelectedBlockClientIds]); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/pre-parse-patterns.js +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + +const requestIdleCallback = (() => { + if (typeof window === 'undefined') { + return callback => { + setTimeout(() => callback(Date.now()), 0); + }; + } + + return window.requestIdleCallback || window.requestAnimationFrame; +})(); + +const cancelIdleCallback = (() => { + if (typeof window === 'undefined') { + return clearTimeout; + } + + return window.cancelIdleCallback || window.cancelAnimationFrame; +})(); + +function usePreParsePatterns() { + const patterns = (0,external_wp_data_namespaceObject.useSelect)(_select => _select(store).getSettings().__experimentalBlockPatterns, []); + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (!(patterns !== null && patterns !== void 0 && patterns.length)) { + return; + } + + let handle; + let index = -1; + + const callback = () => { + index++; + + if (index >= patterns.length) { + return; + } + + (0,external_wp_data_namespaceObject.select)(store).__experimentalGetParsedPattern(patterns[index].name); + + handle = requestIdleCallback(callback); + }; + + handle = requestIdleCallback(callback); + return () => cancelIdleCallback(handle); + }, [patterns]); + return null; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-block-display-information/index.js +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +/** @typedef {import('@wordpress/blocks').WPIcon} WPIcon */ + +/** + * Contains basic block's information for display reasons. + * + * @typedef {Object} WPBlockDisplayInformation + * + * @property {string} title Human-readable block type label. + * @property {WPIcon} icon Block type icon. + * @property {string} description A detailed block type description. + */ + +/** + * Hook used to try to find a matching block variation and return + * the appropriate information for display reasons. In order to + * to try to find a match we need to things: + * 1. Block's client id to extract it's current attributes. + * 2. A block variation should have set `isActive` prop to a proper function. + * + * If for any reason a block variaton match cannot be found, + * the returned information come from the Block Type. + * If no blockType is found with the provided clientId, returns null. + * + * @param {string} clientId Block's client id. + * @return {?WPBlockDisplayInformation} Block's display information, or `null` when the block or its type not found. + */ + +function useBlockDisplayInformation(clientId) { + return (0,external_wp_data_namespaceObject.useSelect)(select => { + if (!clientId) return null; + const { + getBlockName, + getBlockAttributes + } = select(store); + const { + getBlockType, + getActiveBlockVariation + } = select(external_wp_blocks_namespaceObject.store); + const blockName = getBlockName(clientId); + const blockType = getBlockType(blockName); + if (!blockType) return null; + const attributes = getBlockAttributes(clientId); + const match = getActiveBlockVariation(blockName, attributes); + const blockTypeInfo = { + title: blockType.title, + icon: blockType.icon, + description: blockType.description, + anchor: attributes === null || attributes === void 0 ? void 0 : attributes.anchor + }; + if (!match) return blockTypeInfo; + return { + title: match.title || blockType.title, + icon: match.icon || blockType.icon, + description: match.description || blockType.description + }; + }, [clientId]); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-title/use-block-display-title.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + +/** + * Returns the block's configured title as a string, or empty if the title + * cannot be determined. + * + * @example + * + * ```js + * useBlockDisplayTitle( 'afd1cb17-2c08-4e7a-91be-007ba7ddc3a1', 17 ); + * ``` + * + * @param {string} clientId Client ID of block. + * @param {number|undefined} maximumLength The maximum length that the block title string may be before truncated. + * @return {?string} Block title. + */ + +function useBlockDisplayTitle(clientId, maximumLength) { + const { + attributes, + name, + reusableBlockTitle + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + if (!clientId) { + return {}; + } + + const { + getBlockName, + getBlockAttributes, + __experimentalGetReusableBlockTitle + } = select(store); + const blockName = getBlockName(clientId); + + if (!blockName) { + return {}; + } + + const isReusable = (0,external_wp_blocks_namespaceObject.isReusableBlock)((0,external_wp_blocks_namespaceObject.getBlockType)(blockName)); + return { + attributes: getBlockAttributes(clientId), + name: blockName, + reusableBlockTitle: isReusable && __experimentalGetReusableBlockTitle(getBlockAttributes(clientId).ref) + }; + }, [clientId]); + const blockInformation = useBlockDisplayInformation(clientId); + + if (!name || !blockInformation) { + return null; + } + + const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); + const blockLabel = blockType ? (0,external_wp_blocks_namespaceObject.__experimentalGetBlockLabel)(blockType, attributes) : null; + const label = reusableBlockTitle || blockLabel; // Label will fallback to the title if no label is defined for the current + // label context. If the label is defined we prioritize it over a + // possible block variation title match. + + const blockTitle = label && label !== blockType.title ? label : blockInformation.title; + + if (maximumLength && maximumLength > 0) { + return (0,external_lodash_namespaceObject.truncate)(blockTitle, { + length: maximumLength + }); + } + + return blockTitle; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-title/index.js +/** + * Internal dependencies + */ + +/** + * Renders the block's configured title as a string, or empty if the title + * cannot be determined. + * + * @example + * + * ```jsx + * + * ``` + * + * @param {Object} props + * @param {string} props.clientId Client ID of block. + * @param {number|undefined} props.maximumLength The maximum length that the block title string may be before truncated. + * + * @return {JSX.Element} Block title. + */ + +function BlockTitle(_ref) { + let { + clientId, + maximumLength + } = _ref; + return useBlockDisplayTitle(clientId, maximumLength); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/use-scroll-when-dragging.js +/** + * WordPress dependencies + */ + + +const SCROLL_INACTIVE_DISTANCE_PX = 50; +const SCROLL_INTERVAL_MS = 25; +const PIXELS_PER_SECOND_PER_PERCENTAGE = 1000; +const VELOCITY_MULTIPLIER = PIXELS_PER_SECOND_PER_PERCENTAGE * (SCROLL_INTERVAL_MS / 1000); +/** + * React hook that scrolls the scroll container when a block is being dragged. + * + * @return {Function[]} `startScrolling`, `scrollOnDragOver`, `stopScrolling` + * functions to be called in `onDragStart`, `onDragOver` + * and `onDragEnd` events respectively. + */ + +function useScrollWhenDragging() { + const dragStartY = (0,external_wp_element_namespaceObject.useRef)(null); + const velocityY = (0,external_wp_element_namespaceObject.useRef)(null); + const scrollParentY = (0,external_wp_element_namespaceObject.useRef)(null); + const scrollEditorInterval = (0,external_wp_element_namespaceObject.useRef)(null); // Clear interval when unmounting. + + (0,external_wp_element_namespaceObject.useEffect)(() => () => { + if (scrollEditorInterval.current) { + clearInterval(scrollEditorInterval.current); + scrollEditorInterval.current = null; + } + }, []); + const startScrolling = (0,external_wp_element_namespaceObject.useCallback)(event => { + dragStartY.current = event.clientY; // Find nearest parent(s) to scroll. + + scrollParentY.current = (0,external_wp_dom_namespaceObject.getScrollContainer)(event.target); + scrollEditorInterval.current = setInterval(() => { + if (scrollParentY.current && velocityY.current) { + const newTop = scrollParentY.current.scrollTop + velocityY.current; // Setting `behavior: 'smooth'` as a scroll property seems to hurt performance. + // Better to use a small scroll interval. + + scrollParentY.current.scroll({ + top: newTop + }); + } + }, SCROLL_INTERVAL_MS); + }, []); + const scrollOnDragOver = (0,external_wp_element_namespaceObject.useCallback)(event => { + if (!scrollParentY.current) { + return; + } + + const scrollParentHeight = scrollParentY.current.offsetHeight; + const offsetDragStartPosition = dragStartY.current - scrollParentY.current.offsetTop; + const offsetDragPosition = event.clientY - scrollParentY.current.offsetTop; + + if (event.clientY > offsetDragStartPosition) { + // User is dragging downwards. + const moveableDistance = Math.max(scrollParentHeight - offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0); + const dragDistance = Math.max(offsetDragPosition - offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0); + const distancePercentage = dragDistance / moveableDistance; + velocityY.current = VELOCITY_MULTIPLIER * distancePercentage; + } else if (event.clientY < offsetDragStartPosition) { + // User is dragging upwards. + const moveableDistance = Math.max(offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0); + const dragDistance = Math.max(offsetDragStartPosition - offsetDragPosition - SCROLL_INACTIVE_DISTANCE_PX, 0); + const distancePercentage = dragDistance / moveableDistance; + velocityY.current = -VELOCITY_MULTIPLIER * distancePercentage; + } else { + velocityY.current = 0; + } + }, []); + + const stopScrolling = () => { + dragStartY.current = null; + scrollParentY.current = null; + + if (scrollEditorInterval.current) { + clearInterval(scrollEditorInterval.current); + scrollEditorInterval.current = null; + } + }; + + return [startScrolling, scrollOnDragOver, stopScrolling]; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/index.js + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + + +const BlockDraggable = _ref => { + let { + children, + clientIds, + cloneClassname, + onDragStart, + onDragEnd + } = _ref; + const { + srcRootClientId, + isDraggable, + icon + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + var _getBlockType; + + const { + canMoveBlocks, + getBlockRootClientId, + getBlockName + } = select(store); + const rootClientId = getBlockRootClientId(clientIds[0]); + const blockName = getBlockName(clientIds[0]); + return { + srcRootClientId: rootClientId, + isDraggable: canMoveBlocks(clientIds, rootClientId), + icon: (_getBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName)) === null || _getBlockType === void 0 ? void 0 : _getBlockType.icon + }; + }, [clientIds]); + const isDragging = (0,external_wp_element_namespaceObject.useRef)(false); + const [startScrolling, scrollOnDragOver, stopScrolling] = useScrollWhenDragging(); + const { + startDraggingBlocks, + stopDraggingBlocks + } = (0,external_wp_data_namespaceObject.useDispatch)(store); // Stop dragging blocks if the block draggable is unmounted. + + (0,external_wp_element_namespaceObject.useEffect)(() => { + return () => { + if (isDragging.current) { + stopDraggingBlocks(); + } + }; + }, []); + + if (!isDraggable) { + return children({ + isDraggable: false + }); + } + + const transferData = { + type: 'block', + srcClientIds: clientIds, + srcRootClientId + }; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Draggable, { + cloneClassname: cloneClassname, + __experimentalTransferDataType: "wp-blocks", + transferData: transferData, + onDragStart: event => { + startDraggingBlocks(clientIds); + isDragging.current = true; + startScrolling(event); + + if (onDragStart) { + onDragStart(); + } + }, + onDragOver: scrollOnDragOver, + onDragEnd: () => { + stopDraggingBlocks(); + isDragging.current = false; + stopScrolling(); + + if (onDragEnd) { + onDragEnd(); + } + }, + __experimentalDragComponent: (0,external_wp_element_namespaceObject.createElement)(BlockDraggableChip, { + count: clientIds.length, + icon: icon + }) + }, _ref2 => { + let { + onDraggableStart, + onDraggableEnd + } = _ref2; + return children({ + draggable: true, + onDragStart: onDraggableStart, + onDragEnd: onDraggableEnd + }); + }); +}; + +/* harmony default export */ var block_draggable = (BlockDraggable); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/block-selection-button.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + + + + + +/** + * Internal dependencies + */ + + + + + + +/** + * Block selection button 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 Component props. + * @param {string} props.clientId Client ID of block. + * + * @return {WPComponent} The component to be rendered. + */ + +function BlockSelectionButton(_ref) { + let { + clientId, + rootClientId, + blockElement + } = _ref; + const blockInformation = useBlockDisplayInformation(clientId); + const selected = (0,external_wp_data_namespaceObject.useSelect)(select => { + var _getBlockListSettings; + + const { + getBlock, + getBlockIndex, + hasBlockMovingClientId, + getBlockListSettings + } = select(store); + const index = getBlockIndex(clientId); + const { + name, + attributes + } = getBlock(clientId); + const blockMovingMode = hasBlockMovingClientId(); + return { + index, + name, + attributes, + blockMovingMode, + orientation: (_getBlockListSettings = getBlockListSettings(rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation + }; + }, [clientId, rootClientId]); + const { + index, + name, + attributes, + blockMovingMode, + orientation + } = selected; + const { + setNavigationMode, + removeBlock + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const ref = (0,external_wp_element_namespaceObject.useRef)(); + const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); + const label = (0,external_wp_blocks_namespaceObject.__experimentalGetAccessibleBlockLabel)(blockType, attributes, index + 1, orientation); // Focus the breadcrumb in navigation mode. + + (0,external_wp_element_namespaceObject.useEffect)(() => { + ref.current.focus(); + (0,external_wp_a11y_namespaceObject.speak)(label); + }, [label]); + const { + hasBlockMovingClientId, + getBlockIndex, + getBlockRootClientId, + getClientIdsOfDescendants, + getSelectedBlockClientId, + getMultiSelectedBlocksEndClientId, + getPreviousBlockClientId, + getNextBlockClientId, + isNavigationMode + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const { + selectBlock, + clearSelectedBlock, + setBlockMovingClientId, + moveBlockToPosition + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + + function onKeyDown(event) { + const { + keyCode + } = event; + const isUp = keyCode === external_wp_keycodes_namespaceObject.UP; + const isDown = keyCode === external_wp_keycodes_namespaceObject.DOWN; + const isLeft = keyCode === external_wp_keycodes_namespaceObject.LEFT; + const isRight = keyCode === external_wp_keycodes_namespaceObject.RIGHT; + const isTab = keyCode === external_wp_keycodes_namespaceObject.TAB; + const isEscape = keyCode === external_wp_keycodes_namespaceObject.ESCAPE; + const isEnter = keyCode === external_wp_keycodes_namespaceObject.ENTER; + const isSpace = keyCode === external_wp_keycodes_namespaceObject.SPACE; + const isShift = event.shiftKey; + + if (keyCode === external_wp_keycodes_namespaceObject.BACKSPACE || keyCode === external_wp_keycodes_namespaceObject.DELETE) { + removeBlock(clientId); + event.preventDefault(); + return; + } + + const selectedBlockClientId = getSelectedBlockClientId(); + const selectionEndClientId = getMultiSelectedBlocksEndClientId(); + const selectionBeforeEndClientId = getPreviousBlockClientId(selectionEndClientId || selectedBlockClientId); + const selectionAfterEndClientId = getNextBlockClientId(selectionEndClientId || selectedBlockClientId); + const navigateUp = isTab && isShift || isUp; + const navigateDown = isTab && !isShift || isDown; // Move out of current nesting level (no effect if at root level). + + const navigateOut = isLeft; // Move into next nesting level (no effect if the current block has no innerBlocks). + + const navigateIn = isRight; + let focusedBlockUid; + + if (navigateUp) { + focusedBlockUid = selectionBeforeEndClientId; + } else if (navigateDown) { + focusedBlockUid = selectionAfterEndClientId; + } else if (navigateOut) { + var _getBlockRootClientId; + + focusedBlockUid = (_getBlockRootClientId = getBlockRootClientId(selectedBlockClientId)) !== null && _getBlockRootClientId !== void 0 ? _getBlockRootClientId : selectedBlockClientId; + } else if (navigateIn) { + var _getClientIdsOfDescen; + + focusedBlockUid = (_getClientIdsOfDescen = getClientIdsOfDescendants([selectedBlockClientId])[0]) !== null && _getClientIdsOfDescen !== void 0 ? _getClientIdsOfDescen : selectedBlockClientId; + } + + const startingBlockClientId = hasBlockMovingClientId(); + + if (isEscape && isNavigationMode()) { + clearSelectedBlock(); + event.preventDefault(); + } + + if (isEscape && startingBlockClientId && !event.defaultPrevented) { + setBlockMovingClientId(null); + event.preventDefault(); + } + + if ((isEnter || isSpace) && startingBlockClientId) { + const sourceRoot = getBlockRootClientId(startingBlockClientId); + const destRoot = getBlockRootClientId(selectedBlockClientId); + const sourceBlockIndex = getBlockIndex(startingBlockClientId); + let destinationBlockIndex = getBlockIndex(selectedBlockClientId); + + if (sourceBlockIndex < destinationBlockIndex && sourceRoot === destRoot) { + destinationBlockIndex -= 1; + } + + moveBlockToPosition(startingBlockClientId, sourceRoot, destRoot, destinationBlockIndex); + selectBlock(startingBlockClientId); + setBlockMovingClientId(null); + } + + if (navigateDown || navigateUp || navigateOut || navigateIn) { + if (focusedBlockUid) { + event.preventDefault(); + selectBlock(focusedBlockUid); + } else if (isTab && selectedBlockClientId) { + let nextTabbable; + + if (navigateDown) { + nextTabbable = blockElement; + + do { + nextTabbable = external_wp_dom_namespaceObject.focus.tabbable.findNext(nextTabbable); + } while (nextTabbable && blockElement.contains(nextTabbable)); + + if (!nextTabbable) { + nextTabbable = blockElement.ownerDocument.defaultView.frameElement; + nextTabbable = external_wp_dom_namespaceObject.focus.tabbable.findNext(nextTabbable); + } + } else { + nextTabbable = external_wp_dom_namespaceObject.focus.tabbable.findPrevious(blockElement); + } + + if (nextTabbable) { + event.preventDefault(); + nextTabbable.focus(); + clearSelectedBlock(); + } + } + } + } + + const classNames = classnames_default()('block-editor-block-list__block-selection-button', { + 'is-block-moving-mode': !!blockMovingMode + }); + + const dragHandleLabel = (0,external_wp_i18n_namespaceObject.__)('Drag'); + + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: classNames + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { + justify: "center", + className: "block-editor-block-list__block-selection-button__content" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(block_icon, { + icon: blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon, + showColors: true + })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(block_draggable, { + clientIds: [clientId] + }, draggableProps => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({ + icon: drag_handle, + className: "block-selection-button_drag-handle", + "aria-hidden": "true", + label: dragHandleLabel // Should not be able to tab to drag handle as this + // button can only be used with a pointer device. + , + tabIndex: "-1" + }, draggableProps)))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + ref: ref, + onClick: () => setNavigationMode(false), + onKeyDown: onKeyDown, + label: label, + className: "block-selection-button_select-button" + }, (0,external_wp_element_namespaceObject.createElement)(BlockTitle, { + clientId: clientId, + maximumLength: 35 + }))))); +} + +/* harmony default export */ var block_selection_button = (BlockSelectionButton); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/navigable-toolbar/index.js + + + +/** + * WordPress dependencies + */ + + + + + + +function hasOnlyToolbarItem(elements) { + const dataProp = 'toolbarItem'; + return !elements.some(element => !(dataProp in element.dataset)); +} + +function getAllToolbarItemsIn(container) { + return Array.from(container.querySelectorAll('[data-toolbar-item]')); +} + +function hasFocusWithin(container) { + return container.contains(container.ownerDocument.activeElement); +} + +function focusFirstTabbableIn(container) { + const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(container); + + if (firstTabbable) { + firstTabbable.focus(); + } +} + +function useIsAccessibleToolbar(ref) { + /* + * By default, we'll assume the starting accessible state of the Toolbar + * is true, as it seems to be the most common case. + * + * Transitioning from an (initial) false to true state causes the + * component to mount twice, which is causing undesired + * side-effects. These side-effects appear to only affect certain + * E2E tests. + * + * This was initial discovered in this pull-request: + * https://github.com/WordPress/gutenberg/pull/23425 + */ + const initialAccessibleToolbarState = true; // By default, it's gonna render NavigableMenu. If all the tabbable elements + // inside the toolbar are ToolbarItem components (or derived components like + // ToolbarButton), then we can wrap them with the accessible Toolbar + // component. + + const [isAccessibleToolbar, setIsAccessibleToolbar] = (0,external_wp_element_namespaceObject.useState)(initialAccessibleToolbarState); + const determineIsAccessibleToolbar = (0,external_wp_element_namespaceObject.useCallback)(() => { + const tabbables = external_wp_dom_namespaceObject.focus.tabbable.find(ref.current); + const onlyToolbarItem = hasOnlyToolbarItem(tabbables); + + if (!onlyToolbarItem) { + external_wp_deprecated_default()('Using custom components as toolbar controls', { + since: '5.6', + alternative: 'ToolbarItem, ToolbarButton or ToolbarDropdownMenu components', + link: 'https://developer.wordpress.org/block-editor/components/toolbar-button/#inside-blockcontrols' + }); + } + + setIsAccessibleToolbar(onlyToolbarItem); + }, []); + (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { + // Toolbar buttons may be rendered asynchronously, so we use + // MutationObserver to check if the toolbar subtree has been modified. + const observer = new window.MutationObserver(determineIsAccessibleToolbar); + observer.observe(ref.current, { + childList: true, + subtree: true + }); + return () => observer.disconnect(); + }, [isAccessibleToolbar]); + return isAccessibleToolbar; +} + +function useToolbarFocus(ref, focusOnMount, isAccessibleToolbar, defaultIndex, onIndexChange) { + // Make sure we don't use modified versions of this prop. + const [initialFocusOnMount] = (0,external_wp_element_namespaceObject.useState)(focusOnMount); + const [initialIndex] = (0,external_wp_element_namespaceObject.useState)(defaultIndex); + const focusToolbar = (0,external_wp_element_namespaceObject.useCallback)(() => { + focusFirstTabbableIn(ref.current); + }, []); // Focus on toolbar when pressing alt+F10 when the toolbar is visible. + + (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/block-editor/focus-toolbar', focusToolbar); + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (initialFocusOnMount) { + focusToolbar(); + } + }, [isAccessibleToolbar, initialFocusOnMount, focusToolbar]); + (0,external_wp_element_namespaceObject.useEffect)(() => { + // If initialIndex is passed, we focus on that toolbar item when the + // toolbar gets mounted and initial focus is not forced. + // We have to wait for the next browser paint because block controls aren't + // rendered right away when the toolbar gets mounted. + let raf = 0; + + if (initialIndex && !initialFocusOnMount) { + raf = window.requestAnimationFrame(() => { + const items = getAllToolbarItemsIn(ref.current); + const index = initialIndex || 0; + + if (items[index] && hasFocusWithin(ref.current)) { + items[index].focus(); + } + }); + } + + return () => { + window.cancelAnimationFrame(raf); + if (!onIndexChange || !ref.current) return; // When the toolbar element is unmounted and onIndexChange is passed, we + // pass the focused toolbar item index so it can be hydrated later. + + const items = getAllToolbarItemsIn(ref.current); + const index = items.findIndex(item => item.tabIndex === 0); + onIndexChange(index); + }; + }, [initialIndex, initialFocusOnMount]); +} + +function NavigableToolbar(_ref) { + let { + children, + focusOnMount, + __experimentalInitialIndex: initialIndex, + __experimentalOnIndexChange: onIndexChange, + ...props + } = _ref; + const ref = (0,external_wp_element_namespaceObject.useRef)(); + const isAccessibleToolbar = useIsAccessibleToolbar(ref); + useToolbarFocus(ref, focusOnMount, isAccessibleToolbar, initialIndex, onIndexChange); + + if (isAccessibleToolbar) { + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Toolbar, _extends({ + label: props['aria-label'], + ref: ref + }, props), children); + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NavigableMenu, _extends({ + orientation: "horizontal", + role: "toolbar", + ref: ref + }, props), children); +} + +/* harmony default export */ var navigable_toolbar = (NavigableToolbar); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js + + +/** + * WordPress dependencies + */ + +const chevronRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" +})); +/* harmony default export */ var chevron_right = (chevronRight); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js + + +/** + * WordPress dependencies + */ + +const chevronLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" +})); +/* harmony default export */ var chevron_left = (chevronLeft); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-up.js + + +/** + * WordPress dependencies + */ + +const chevronUp = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" +})); +/* harmony default export */ var chevron_up = (chevronUp); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js + + +/** + * WordPress dependencies + */ + +const chevronDown = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" +})); +/* harmony default export */ var chevron_down = (chevronDown); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-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). + * @param {string} orientation The orientation of the block movers, vertical or + * horizontal. + * + * @return {string} Label for the block movement controls. + */ + +function getBlockMoverDescription(selectedCount, type, firstIndex, isFirst, isLast, dir, orientation) { + const position = firstIndex + 1; + + const getMovementDirection = moveDirection => { + if (moveDirection === 'up') { + if (orientation === 'horizontal') { + return (0,external_wp_i18n_namespaceObject.isRTL)() ? 'right' : 'left'; + } + + return 'up'; + } else if (moveDirection === 'down') { + if (orientation === 'horizontal') { + return (0,external_wp_i18n_namespaceObject.isRTL)() ? 'left' : 'right'; + } + + return 'down'; + } + + return null; + }; + + if (selectedCount > 1) { + return getMultiBlockMoverDescription(selectedCount, firstIndex, isFirst, isLast, dir); + } + + if (isFirst && isLast) { + return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Type of block (i.e. Text, Image etc) + (0,external_wp_i18n_namespaceObject.__)('Block %s is the only block, and cannot be moved'), type); + } + + if (dir > 0 && !isLast) { + // Moving down. + const movementDirection = getMovementDirection('down'); + + if (movementDirection === 'down') { + return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position + (0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d down to position %3$d'), type, position, position + 1); + } + + if (movementDirection === 'left') { + return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position + (0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d left to position %3$d'), type, position, position + 1); + } + + if (movementDirection === 'right') { + return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position + (0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d right to position %3$d'), type, position, position + 1); + } + } + + if (dir > 0 && isLast) { + // Moving down, and is the last item. + const movementDirection = getMovementDirection('down'); + + if (movementDirection === 'down') { + return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc) + (0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the end of the content and can’t be moved down'), type); + } + + if (movementDirection === 'left') { + return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc) + (0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the end of the content and can’t be moved left'), type); + } + + if (movementDirection === 'right') { + return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc) + (0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the end of the content and can’t be moved right'), type); + } + } + + if (dir < 0 && !isFirst) { + // Moving up. + const movementDirection = getMovementDirection('up'); + + if (movementDirection === 'up') { + return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position + (0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d up to position %3$d'), type, position, position - 1); + } + + if (movementDirection === 'left') { + return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position + (0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d left to position %3$d'), type, position, position - 1); + } + + if (movementDirection === 'right') { + return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position + (0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d right to position %3$d'), type, position, position - 1); + } + } + + if (dir < 0 && isFirst) { + // Moving up, and is the first item. + const movementDirection = getMovementDirection('up'); + + if (movementDirection === 'up') { + return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc) + (0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the beginning of the content and can’t be moved up'), type); + } + + if (movementDirection === 'left') { + return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc) + (0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the beginning of the content and can’t be moved left'), type); + } + + if (movementDirection === 'right') { + return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc) + (0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the beginning of the content and can’t be moved right'), 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) { + const position = firstIndex + 1; + + if (dir < 0 && isFirst) { + return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved up as they are already at the top'); + } + + if (dir > 0 && isLast) { + return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved down as they are already at the bottom'); + } + + if (dir < 0 && !isFirst) { + return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Number of selected blocks, 2: Position of selected blocks + (0,external_wp_i18n_namespaceObject._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 (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Number of selected blocks, 2: Position of selected blocks + (0,external_wp_i18n_namespaceObject._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/block-editor/build-module/components/block-mover/button.js + + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + + + +/** + * Internal dependencies + */ + + + + + +const getArrowIcon = (direction, orientation) => { + if (direction === 'up') { + if (orientation === 'horizontal') { + return (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left; + } + + return chevron_up; + } else if (direction === 'down') { + if (orientation === 'horizontal') { + return (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right; + } + + return chevron_down; + } + + return null; +}; + +const getMovementDirectionLabel = (moveDirection, orientation) => { + if (moveDirection === 'up') { + if (orientation === 'horizontal') { + return (0,external_wp_i18n_namespaceObject.isRTL)() ? (0,external_wp_i18n_namespaceObject.__)('Move right') : (0,external_wp_i18n_namespaceObject.__)('Move left'); + } + + return (0,external_wp_i18n_namespaceObject.__)('Move up'); + } else if (moveDirection === 'down') { + if (orientation === 'horizontal') { + return (0,external_wp_i18n_namespaceObject.isRTL)() ? (0,external_wp_i18n_namespaceObject.__)('Move left') : (0,external_wp_i18n_namespaceObject.__)('Move right'); + } + + return (0,external_wp_i18n_namespaceObject.__)('Move down'); + } + + return null; +}; + +const BlockMoverButton = (0,external_wp_element_namespaceObject.forwardRef)((_ref, ref) => { + let { + clientIds, + direction, + orientation: moverOrientation, + ...props + } = _ref; + const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockMoverButton); + const blocksCount = (0,external_lodash_namespaceObject.castArray)(clientIds).length; + const { + blockType, + isDisabled, + rootClientId, + isFirst, + isLast, + firstIndex, + orientation = 'vertical' + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getBlockIndex, + getBlockRootClientId, + getBlockOrder, + getBlock, + getBlockListSettings + } = select(store); + const normalizedClientIds = (0,external_lodash_namespaceObject.castArray)(clientIds); + const firstClientId = (0,external_lodash_namespaceObject.first)(normalizedClientIds); + const blockRootClientId = getBlockRootClientId(firstClientId); + const firstBlockIndex = getBlockIndex(firstClientId); + const lastBlockIndex = getBlockIndex((0,external_lodash_namespaceObject.last)(normalizedClientIds)); + const blockOrder = getBlockOrder(blockRootClientId); + const block = getBlock(firstClientId); + const isFirstBlock = firstBlockIndex === 0; + const isLastBlock = lastBlockIndex === blockOrder.length - 1; + const { + orientation: blockListOrientation + } = getBlockListSettings(blockRootClientId) || {}; + return { + blockType: block ? (0,external_wp_blocks_namespaceObject.getBlockType)(block.name) : null, + isDisabled: direction === 'up' ? isFirstBlock : isLastBlock, + rootClientId: blockRootClientId, + firstIndex: firstBlockIndex, + isFirst: isFirstBlock, + isLast: isLastBlock, + orientation: moverOrientation || blockListOrientation + }; + }, [clientIds, direction]); + const { + moveBlocksDown, + moveBlocksUp + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const moverFunction = direction === 'up' ? moveBlocksUp : moveBlocksDown; + + const onClick = event => { + moverFunction(clientIds, rootClientId); + + if (props.onClick) { + props.onClick(event); + } + }; + + const descriptionId = `block-editor-block-mover-button__description-${instanceId}`; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({ + ref: ref, + className: classnames_default()('block-editor-block-mover-button', `is-${direction}-button`), + icon: getArrowIcon(direction, orientation), + label: getMovementDirectionLabel(direction, orientation), + "aria-describedby": descriptionId + }, props, { + onClick: isDisabled ? null : onClick, + "aria-disabled": isDisabled + })), (0,external_wp_element_namespaceObject.createElement)("span", { + id: descriptionId, + className: "block-editor-block-mover-button__description" + }, getBlockMoverDescription(blocksCount, blockType && blockType.title, firstIndex, isFirst, isLast, direction === 'up' ? -1 : 1, orientation))); +}); +const BlockMoverUpButton = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { + return (0,external_wp_element_namespaceObject.createElement)(BlockMoverButton, _extends({ + direction: "up", + ref: ref + }, props)); +}); +const BlockMoverDownButton = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { + return (0,external_wp_element_namespaceObject.createElement)(BlockMoverButton, _extends({ + direction: "down", + ref: ref + }, props)); +}); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-mover/index.js + + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + + + +/** + * Internal dependencies + */ + + + + + +function BlockMover(_ref) { + let { + isFirst, + isLast, + clientIds, + canMove, + isHidden, + rootClientId, + orientation, + hideDragHandle + } = _ref; + const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); + + const onFocus = () => setIsFocused(true); + + const onBlur = () => setIsFocused(false); + + if (!canMove || isFirst && isLast && !rootClientId) { + return null; + } + + const dragHandleLabel = (0,external_wp_i18n_namespaceObject.__)('Drag'); // We emulate a disabled state because forcefully applying the `disabled` + // attribute on the buttons 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 (0,external_wp_element_namespaceObject.createElement)("div", { + className: classnames_default()('block-editor-block-mover', { + 'is-visible': isFocused || !isHidden, + 'is-horizontal': orientation === 'horizontal' + }) + }, !hideDragHandle && (0,external_wp_element_namespaceObject.createElement)(block_draggable, { + clientIds: clientIds, + cloneClassname: "block-editor-block-mover__drag-clone" + }, draggableProps => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({ + icon: drag_handle, + className: "block-editor-block-mover__drag-handle", + "aria-hidden": "true", + label: dragHandleLabel // Should not be able to tab to drag handle as this + // button can only be used with a pointer device. + , + tabIndex: "-1" + }, draggableProps))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, { + className: "block-editor-block-mover__move-button-container" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, { + onFocus: onFocus, + onBlur: onBlur + }, itemProps => (0,external_wp_element_namespaceObject.createElement)(BlockMoverUpButton, _extends({ + clientIds: clientIds + }, itemProps))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, { + onFocus: onFocus, + onBlur: onBlur + }, itemProps => (0,external_wp_element_namespaceObject.createElement)(BlockMoverDownButton, _extends({ + clientIds: clientIds + }, itemProps))))); +} +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-mover/README.md + */ + + +/* harmony default export */ var block_mover = ((0,external_wp_data_namespaceObject.withSelect)((select, _ref2) => { + var _getBlockListSettings; + + let { + clientIds + } = _ref2; + const { + getBlock, + getBlockIndex, + getBlockListSettings, + canMoveBlocks, + getBlockOrder, + getBlockRootClientId + } = select(store); + const normalizedClientIds = (0,external_lodash_namespaceObject.castArray)(clientIds); + const firstClientId = (0,external_lodash_namespaceObject.first)(normalizedClientIds); + const block = getBlock(firstClientId); + const rootClientId = getBlockRootClientId((0,external_lodash_namespaceObject.first)(normalizedClientIds)); + const firstIndex = getBlockIndex(firstClientId); + const lastIndex = getBlockIndex((0,external_lodash_namespaceObject.last)(normalizedClientIds)); + const blockOrder = getBlockOrder(rootClientId); + const isFirst = firstIndex === 0; + const isLast = lastIndex === blockOrder.length - 1; + return { + blockType: block ? (0,external_wp_blocks_namespaceObject.getBlockType)(block.name) : null, + canMove: canMoveBlocks(clientIds, rootClientId), + rootClientId, + firstIndex, + isFirst, + isLast, + orientation: (_getBlockListSettings = getBlockListSettings(rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation + }; +})(BlockMover)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/utils.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +const { + clearTimeout: utils_clearTimeout, + setTimeout: utils_setTimeout +} = window; +const DEBOUNCE_TIMEOUT = 200; +/** + * Hook that creates a showMover state, as well as debounced show/hide callbacks. + * + * @param {Object} props Component props. + * @param {Object} props.ref Element reference. + * @param {boolean} props.isFocused Whether the component has current focus. + * @param {number} [props.debounceTimeout=250] Debounce timeout in milliseconds. + * @param {Function} [props.onChange=noop] Callback function. + */ + +function useDebouncedShowMovers(_ref) { + let { + ref, + isFocused, + debounceTimeout = DEBOUNCE_TIMEOUT, + onChange = external_lodash_namespaceObject.noop + } = _ref; + const [showMovers, setShowMovers] = (0,external_wp_element_namespaceObject.useState)(false); + const timeoutRef = (0,external_wp_element_namespaceObject.useRef)(); + + const handleOnChange = nextIsFocused => { + if (ref !== null && ref !== void 0 && ref.current) { + setShowMovers(nextIsFocused); + } + + onChange(nextIsFocused); + }; + + const getIsHovered = () => { + return (ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.matches(':hover'); + }; + + const shouldHideMovers = () => { + const isHovered = getIsHovered(); + return !isFocused && !isHovered; + }; + + const clearTimeoutRef = () => { + const timeout = timeoutRef.current; + + if (timeout && utils_clearTimeout) { + utils_clearTimeout(timeout); + } + }; + + const debouncedShowMovers = event => { + if (event) { + event.stopPropagation(); + } + + clearTimeoutRef(); + + if (!showMovers) { + handleOnChange(true); + } + }; + + const debouncedHideMovers = event => { + if (event) { + event.stopPropagation(); + } + + clearTimeoutRef(); + timeoutRef.current = utils_setTimeout(() => { + if (shouldHideMovers()) { + handleOnChange(false); + } + }, debounceTimeout); + }; + + (0,external_wp_element_namespaceObject.useEffect)(() => () => { + /** + * We need to call the change handler with `isFocused` + * set to false on unmount because we also clear the + * timeout that would handle that. + */ + handleOnChange(false); + clearTimeoutRef(); + }, []); + return { + showMovers, + debouncedShowMovers, + debouncedHideMovers + }; +} +/** + * Hook that provides a showMovers state and gesture events for DOM elements + * that interact with the showMovers state. + * + * @param {Object} props Component props. + * @param {Object} props.ref Element reference. + * @param {number} [props.debounceTimeout=250] Debounce timeout in milliseconds. + * @param {Function} [props.onChange=noop] Callback function. + */ + +function useShowMoversGestures(_ref2) { + let { + ref, + debounceTimeout = DEBOUNCE_TIMEOUT, + onChange = external_lodash_namespaceObject.noop + } = _ref2; + const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); + const { + showMovers, + debouncedShowMovers, + debouncedHideMovers + } = useDebouncedShowMovers({ + ref, + debounceTimeout, + isFocused, + onChange + }); + const registerRef = (0,external_wp_element_namespaceObject.useRef)(false); + + const isFocusedWithin = () => { + return (ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.contains(ref.current.ownerDocument.activeElement); + }; + + (0,external_wp_element_namespaceObject.useEffect)(() => { + const node = ref.current; + + const handleOnFocus = () => { + if (isFocusedWithin()) { + setIsFocused(true); + debouncedShowMovers(); + } + }; + + const handleOnBlur = () => { + if (!isFocusedWithin()) { + setIsFocused(false); + debouncedHideMovers(); + } + }; + /** + * Events are added via DOM events (vs. React synthetic events), + * as the child React components swallow mouse events. + */ + + + if (node && !registerRef.current) { + node.addEventListener('focus', handleOnFocus, true); + node.addEventListener('blur', handleOnBlur, true); + registerRef.current = true; + } + + return () => { + if (node) { + node.removeEventListener('focus', handleOnFocus); + node.removeEventListener('blur', handleOnBlur); + } + }; + }, [ref, registerRef, setIsFocused, debouncedShowMovers, debouncedHideMovers]); + return { + showMovers, + gestures: { + onMouseMove: debouncedShowMovers, + onMouseLeave: debouncedHideMovers + } + }; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-parent-selector/index.js + + + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + + + +/** + * Block parent selector component, displaying the hierarchy of the + * current block selection as a single icon to "go up" a level. + * + * @return {WPComponent} Parent block selector. + */ + +function BlockParentSelector() { + const { + selectBlock, + toggleBlockHighlight + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const { + firstParentClientId, + shouldHide, + hasReducedUI + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getBlockName, + getBlockParents, + getSelectedBlockClientId, + getSettings + } = select(store); + const { + hasBlockSupport + } = select(external_wp_blocks_namespaceObject.store); + const selectedBlockClientId = getSelectedBlockClientId(); + const parents = getBlockParents(selectedBlockClientId); + const _firstParentClientId = parents[parents.length - 1]; + const parentBlockName = getBlockName(_firstParentClientId); + + const _parentBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(parentBlockName); + + const settings = getSettings(); + return { + firstParentClientId: _firstParentClientId, + shouldHide: !hasBlockSupport(_parentBlockType, '__experimentalParentSelector', true), + hasReducedUI: settings.hasReducedUI + }; + }, []); + const blockInformation = useBlockDisplayInformation(firstParentClientId); // Allows highlighting the parent block outline when focusing or hovering + // the parent block selector within the child. + + const nodeRef = (0,external_wp_element_namespaceObject.useRef)(); + const { + gestures: showMoversGestures + } = useShowMoversGestures({ + ref: nodeRef, + + onChange(isFocused) { + if (isFocused && hasReducedUI) { + return; + } + + toggleBlockHighlight(firstParentClientId, isFocused); + } + + }); + + if (shouldHide || firstParentClientId === undefined) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)("div", _extends({ + className: "block-editor-block-parent-selector", + key: firstParentClientId, + ref: nodeRef + }, showMoversGestures), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + className: "block-editor-block-parent-selector__button", + onClick: () => selectBlock(firstParentClientId), + label: (0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %s: Name of the block's parent. */ + (0,external_wp_i18n_namespaceObject.__)('Select %s'), blockInformation.title), + showTooltip: true, + icon: (0,external_wp_element_namespaceObject.createElement)(block_icon, { + icon: blockInformation.icon + }) + })); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/copy.js + + +/** + * WordPress dependencies + */ + +const copy = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M20.2 8v11c0 .7-.6 1.2-1.2 1.2H6v1.5h13c1.5 0 2.7-1.2 2.7-2.8V8zM18 16.4V4.6c0-.9-.7-1.6-1.6-1.6H4.6C3.7 3 3 3.7 3 4.6v11.8c0 .9.7 1.6 1.6 1.6h11.8c.9 0 1.6-.7 1.6-1.6zm-13.5 0V4.6c0-.1.1-.1.1-.1h11.8c.1 0 .1.1.1.1v11.8c0 .1-.1.1-.1.1H4.6l-.1-.1z" +})); +/* harmony default export */ var library_copy = (copy); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/preview-block-popover.js + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +function PreviewBlockPopover(_ref) { + let { + blocks + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-switcher__popover__preview__parent" + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-switcher__popover__preview__container" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, { + className: "block-editor-block-switcher__preview__popover", + position: "bottom right", + focusOnMount: false + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-switcher__preview" + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-switcher__preview-title" + }, (0,external_wp_i18n_namespaceObject.__)('Preview')), (0,external_wp_element_namespaceObject.createElement)(block_preview, { + viewportWidth: 500, + blocks: blocks + }))))); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-transformations-menu.js + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + +const BlockTransformationsMenu = _ref => { + let { + className, + possibleBlockTransformations, + onSelect, + blocks + } = _ref; + const [hoveredTransformItemName, setHoveredTransformItemName] = (0,external_wp_element_namespaceObject.useState)(); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { + label: (0,external_wp_i18n_namespaceObject.__)('Transform to'), + className: className + }, hoveredTransformItemName && (0,external_wp_element_namespaceObject.createElement)(PreviewBlockPopover, { + blocks: (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, hoveredTransformItemName) + }), possibleBlockTransformations.map(item => { + const { + name, + icon, + title, + isDisabled + } = item; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + key: name, + className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(name), + onClick: event => { + event.preventDefault(); + onSelect(name); + }, + disabled: isDisabled, + onMouseLeave: () => setHoveredTransformItemName(null), + onMouseEnter: () => setHoveredTransformItemName(name) + }, (0,external_wp_element_namespaceObject.createElement)(block_icon, { + icon: icon, + showColors: true + }), title); + })); +}; + +/* harmony default export */ var block_transformations_menu = (BlockTransformationsMenu); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js + + +/** + * WordPress dependencies + */ + +const check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" +})); +/* harmony default export */ var library_check = (check); + +;// CONCATENATED MODULE: external ["wp","tokenList"] +var external_wp_tokenList_namespaceObject = window["wp"]["tokenList"]; +var external_wp_tokenList_default = /*#__PURE__*/__webpack_require__.n(external_wp_tokenList_namespaceObject); +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-styles/utils.js +/** + * External dependencies + */ + +/** + * WordPress 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) { + for (const style of new (external_wp_tokenList_default())(className).values()) { + if (style.indexOf('is-style-') === -1) { + continue; + } + + const potentialStyleName = style.substring(9); + const activeStyle = (0,external_lodash_namespaceObject.find)(styles, { + name: potentialStyleName + }); + + if (activeStyle) { + return activeStyle; + } + } + + return (0,external_lodash_namespaceObject.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) { + const list = new (external_wp_tokenList_default())(className); + + if (activeStyle) { + list.remove('is-style-' + activeStyle.name); + } + + list.add('is-style-' + newStyle.name); + return list.value; +} +/** + * Returns a collection of styles that can be represented on the frontend. + * The function checks a style collection for a default style. If none is found, it adds one to + * act as a fallback for when there is no active style applied to a block. The default item also serves + * as a switch on the frontend to deactivate non-default styles. + * + * @param {Array} styles Block style variations. + * + * @return {Array} The style collection. + */ + +function getRenderedStyles(styles) { + if (!styles || styles.length === 0) { + return []; + } + + return getDefaultStyle(styles) ? styles : [{ + name: 'default', + label: (0,external_wp_i18n_namespaceObject._x)('Default', 'block style'), + isDefault: true + }, ...styles]; +} +/** + * Returns a style object from a collection of styles where that style object is the default block style. + * + * @param {Array} styles Block style variations. + * + * @return {Object?} The default style object, if found. + */ + +function getDefaultStyle(styles) { + return (0,external_lodash_namespaceObject.find)(styles, 'isDefault'); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-styles/use-styles-for-block.js +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + +/** + * + * @param {WPBlock} block Block object. + * @param {WPBlockType} type Block type settings. + * @return {WPBlock} A generic block ready for styles preview. + */ + +function useGenericPreviewBlock(block, type) { + return (0,external_wp_element_namespaceObject.useMemo)(() => { + const example = type === null || type === void 0 ? void 0 : type.example; + const blockName = type === null || type === void 0 ? void 0 : type.name; + + if (example && blockName) { + return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockName, { + attributes: example.attributes, + innerBlocks: example.innerBlocks + }); + } + + if (block) { + return (0,external_wp_blocks_namespaceObject.cloneBlock)(block); + } + }, [type !== null && type !== void 0 && type.example ? block === null || block === void 0 ? void 0 : block.name : block, type]); +} +/** + * @typedef useStylesForBlocksArguments + * @property {string} clientId Block client ID. + * @property {() => void} onSwitch Block style switch callback function. + */ + +/** + * + * @param {useStylesForBlocksArguments} useStylesForBlocks arguments. + * @return {Object} Results of the select methods. + */ + + +function useStylesForBlocks(_ref) { + let { + clientId, + onSwitch + } = _ref; + + const selector = select => { + const { + getBlock + } = select(store); + const block = getBlock(clientId); + + if (!block) { + return {}; + } + + const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name); + const { + getBlockStyles + } = select(external_wp_blocks_namespaceObject.store); + return { + block, + blockType, + styles: getBlockStyles(block.name), + className: block.attributes.className || '' + }; + }; + + const { + styles, + block, + blockType, + className + } = (0,external_wp_data_namespaceObject.useSelect)(selector, [clientId]); + const { + updateBlockAttributes + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const stylesToRender = getRenderedStyles(styles); + const activeStyle = getActiveStyle(stylesToRender, className); + const genericPreviewBlock = useGenericPreviewBlock(block, blockType); + + const onSelect = style => { + const styleClassName = replaceActiveStyle(className, activeStyle, style); + updateBlockAttributes(clientId, { + className: styleClassName + }); + onSwitch(); + }; + + return { + onSelect, + stylesToRender, + activeStyle, + genericPreviewBlock, + className + }; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-styles/menu-items.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + +function BlockStylesMenuItems(_ref) { + let { + clientId, + onSwitch = external_lodash_namespaceObject.noop + } = _ref; + const { + onSelect, + stylesToRender, + activeStyle + } = useStylesForBlocks({ + clientId, + onSwitch + }); + + if (!stylesToRender || stylesToRender.length === 0) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, stylesToRender.map(style => { + const menuItemText = style.label || style.name; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + key: style.name, + icon: activeStyle.name === style.name ? library_check : null, + onClick: () => onSelect(style) + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, { + as: "span", + limit: 18, + ellipsizeMode: "tail", + truncate: true + }, menuItemText)); + })); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-styles-menu.js + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +function BlockStylesMenu(_ref) { + let { + hoveredBlock, + onSwitch + } = _ref; + const { + clientId + } = hoveredBlock; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { + label: (0,external_wp_i18n_namespaceObject.__)('Styles'), + className: "block-editor-block-switcher__styles__menugroup" + }, (0,external_wp_element_namespaceObject.createElement)(BlockStylesMenuItems, { + clientId: clientId, + onSwitch: onSwitch + })); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/utils.js +/** + * WordPress dependencies + */ + +/** + * Try to find a matching block by a block's name in a provided + * block. We recurse through InnerBlocks and return the reference + * of the matched block (it could be an InnerBlock). + * If no match is found return nothing. + * + * @param {WPBlock} block The block to try to find a match. + * @param {string} selectedBlockName The block's name to use for matching condition. + * @param {Set} consumedBlocks A set holding the previously matched/consumed blocks. + * + * @return {WPBlock?} The matched block if found or nothing(`undefined`). + */ + +const getMatchingBlockByName = function (block, selectedBlockName) { + let consumedBlocks = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Set(); + const { + clientId, + name, + innerBlocks = [] + } = block; // Check if block has been consumed already. + + if (consumedBlocks.has(clientId)) return; + if (name === selectedBlockName) return block; // Try to find a matching block from InnerBlocks recursively. + + for (const innerBlock of innerBlocks) { + const match = getMatchingBlockByName(innerBlock, selectedBlockName, consumedBlocks); + if (match) return match; + } +}; +/** + * Find and return the block attributes to retain through + * the transformation, based on Block Type's `role:content` + * attributes. If no `role:content` attributes exist, + * return selected block's attributes. + * + * @param {string} name Block type's namespaced name. + * @param {Object} attributes Selected block's attributes. + * @return {Object} The block's attributes to retain. + */ + +const getRetainedBlockAttributes = (name, attributes) => { + const contentAttributes = (0,external_wp_blocks_namespaceObject.__experimentalGetBlockAttributesNamesByRole)(name, 'content'); + if (!(contentAttributes !== null && contentAttributes !== void 0 && contentAttributes.length)) return attributes; + return contentAttributes.reduce((_accumulator, attribute) => { + if (attributes[attribute]) _accumulator[attribute] = attributes[attribute]; + return _accumulator; + }, {}); +}; + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/use-transformed-patterns.js +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +/** + * Mutate the matched block's attributes by getting + * which block type's attributes to retain and prioritize + * them in the merging of the attributes. + * + * @param {WPBlock} match The matched block. + * @param {WPBlock} selectedBlock The selected block. + * @return {void} + */ + +const transformMatchingBlock = (match, selectedBlock) => { + // Get the block attributes to retain through the transformation. + const retainedBlockAttributes = getRetainedBlockAttributes(selectedBlock.name, selectedBlock.attributes); + match.attributes = { ...match.attributes, + ...retainedBlockAttributes + }; +}; +/** + * By providing the selected blocks and pattern's blocks + * find the matching blocks, transform them and return them. + * If not all selected blocks are matched, return nothing. + * + * @param {WPBlock[]} selectedBlocks The selected blocks. + * @param {WPBlock[]} patternBlocks The pattern's blocks. + * @return {WPBlock[]|void} The transformed pattern's blocks or undefined if not all selected blocks have been matched. + */ + +const getPatternTransformedBlocks = (selectedBlocks, patternBlocks) => { + // Clone Pattern's blocks to produce new clientIds and be able to mutate the matches. + const _patternBlocks = patternBlocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block)); + /** + * Keep track of the consumed pattern blocks. + * This is needed because we loop the selected blocks + * and for example we may have selected two paragraphs and + * the pattern's blocks could have more `paragraphs`. + */ + + + const consumedBlocks = new Set(); + + for (const selectedBlock of selectedBlocks) { + let isMatch = false; + + for (const patternBlock of _patternBlocks) { + const match = getMatchingBlockByName(patternBlock, selectedBlock.name, consumedBlocks); + if (!match) continue; + isMatch = true; + consumedBlocks.add(match.clientId); // We update (mutate) the matching pattern block. + + transformMatchingBlock(match, selectedBlock); // No need to loop through other pattern's blocks. + + break; + } // Bail eary if a selected block has not been matched. + + + if (!isMatch) return; + } + + return _patternBlocks; +}; +/** + * @typedef {WPBlockPattern & {transformedBlocks: WPBlock[]}} TransformedBlockPattern + */ + +/** + * Custom hook that accepts patterns from state and the selected + * blocks and tries to match these with the pattern's blocks. + * If all selected blocks are matched with a Pattern's block, + * we transform them by retaining block's attributes with `role:content`. + * The transformed pattern's blocks are set to a new pattern + * property `transformedBlocks`. + * + * @param {WPBlockPattern[]} patterns Patterns from state. + * @param {WPBlock[]} selectedBlocks The currently selected blocks. + * @return {TransformedBlockPattern[]} Returns the eligible matched patterns with all the selected blocks. + */ + +const useTransformedPatterns = (patterns, selectedBlocks) => { + return (0,external_wp_element_namespaceObject.useMemo)(() => patterns.reduce((accumulator, _pattern) => { + const transformedBlocks = getPatternTransformedBlocks(selectedBlocks, _pattern.blocks); + + if (transformedBlocks) { + accumulator.push({ ..._pattern, + transformedBlocks + }); + } + + return accumulator; + }, []), [patterns, selectedBlocks]); +}; + +/* harmony default export */ var use_transformed_patterns = (useTransformedPatterns); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/pattern-transformations-menu.js + + + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + + +function PatternTransformationsMenu(_ref) { + let { + blocks, + patterns: statePatterns, + onSelect + } = _ref; + const [showTransforms, setShowTransforms] = (0,external_wp_element_namespaceObject.useState)(false); + const patterns = use_transformed_patterns(statePatterns, blocks); + if (!patterns.length) return null; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { + className: "block-editor-block-switcher__pattern__transforms__menugroup" + }, showTransforms && (0,external_wp_element_namespaceObject.createElement)(PreviewPatternsPopover, { + patterns: patterns, + onSelect: onSelect + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + onClick: event => { + event.preventDefault(); + setShowTransforms(!showTransforms); + }, + icon: chevron_right + }, (0,external_wp_i18n_namespaceObject.__)('Patterns'))); +} + +function PreviewPatternsPopover(_ref2) { + let { + patterns, + onSelect + } = _ref2; + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-switcher__popover__preview__parent" + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-switcher__popover__preview__container" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, { + className: "block-editor-block-switcher__preview__popover", + position: "bottom right" + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-switcher__preview" + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-switcher__preview-title" + }, (0,external_wp_i18n_namespaceObject.__)('Preview')), (0,external_wp_element_namespaceObject.createElement)(BlockPatternsList, { + patterns: patterns, + onSelect: onSelect + }))))); +} + +function BlockPatternsList(_ref3) { + let { + patterns, + onSelect + } = _ref3; + const composite = (0,external_wp_components_namespaceObject.__unstableUseCompositeState)(); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableComposite, _extends({}, composite, { + role: "listbox", + className: "block-editor-block-switcher__preview-patterns-container", + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Patterns list') + }), patterns.map(pattern => (0,external_wp_element_namespaceObject.createElement)(pattern_transformations_menu_BlockPattern, { + key: pattern.name, + pattern: pattern, + onSelect: onSelect, + composite: composite + }))); +} + +function pattern_transformations_menu_BlockPattern(_ref4) { + let { + pattern, + onSelect, + composite + } = _ref4; + // TODO check pattern/preview width... + const baseClassName = 'block-editor-block-switcher__preview-patterns-container'; + const descriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)(pattern_transformations_menu_BlockPattern, `${baseClassName}-list__item-description`); + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: `${baseClassName}-list__list-item`, + "aria-label": pattern.title, + "aria-describedby": pattern.description ? descriptionId : undefined + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableCompositeItem, _extends({ + role: "option", + as: "div" + }, composite, { + className: `${baseClassName}-list__item`, + onClick: () => onSelect(pattern.transformedBlocks) + }), (0,external_wp_element_namespaceObject.createElement)(block_preview, { + blocks: pattern.transformedBlocks, + viewportWidth: pattern.viewportWidth || 500 + }), (0,external_wp_element_namespaceObject.createElement)("div", { + className: `${baseClassName}-list__item-title` + }, pattern.title)), !!pattern.description && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { + id: descriptionId + }, pattern.description)); +} + +/* harmony default export */ var pattern_transformations_menu = (PatternTransformationsMenu); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/index.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + + + + + + +const BlockSwitcherDropdownMenu = _ref => { + let { + clientIds, + blocks + } = _ref; + const { + replaceBlocks + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const blockInformation = useBlockDisplayInformation(blocks[0].clientId); + const { + possibleBlockTransformations, + canRemove, + hasBlockStyles, + icon, + blockTitle, + patterns + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + var _getBlockType2; + + const { + getBlockRootClientId, + getBlockTransformItems, + __experimentalGetPatternTransformItems + } = select(store); + const { + getBlockStyles, + getBlockType + } = select(external_wp_blocks_namespaceObject.store); + const { + canRemoveBlocks + } = select(store); + const rootClientId = getBlockRootClientId((0,external_lodash_namespaceObject.castArray)(clientIds)[0]); + const [{ + name: firstBlockName + }] = blocks; + + const _isSingleBlockSelected = blocks.length === 1; + + const styles = _isSingleBlockSelected && getBlockStyles(firstBlockName); + + let _icon; + + if (_isSingleBlockSelected) { + _icon = blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon; // Take into account active block variations. + } else { + var _getBlockType; + + const isSelectionOfSameType = (0,external_lodash_namespaceObject.uniq)(blocks.map(_ref2 => { + let { + name + } = _ref2; + return name; + })).length === 1; // When selection consists of blocks of multiple types, display an + // appropriate icon to communicate the non-uniformity. + + _icon = isSelectionOfSameType ? (_getBlockType = getBlockType(firstBlockName)) === null || _getBlockType === void 0 ? void 0 : _getBlockType.icon : library_copy; + } + + return { + possibleBlockTransformations: getBlockTransformItems(blocks, rootClientId), + canRemove: canRemoveBlocks(clientIds, rootClientId), + hasBlockStyles: !!(styles !== null && styles !== void 0 && styles.length), + icon: _icon, + blockTitle: (_getBlockType2 = getBlockType(firstBlockName)) === null || _getBlockType2 === void 0 ? void 0 : _getBlockType2.title, + patterns: __experimentalGetPatternTransformItems(blocks, rootClientId) + }; + }, [clientIds, blocks, blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon]); + const isReusable = blocks.length === 1 && (0,external_wp_blocks_namespaceObject.isReusableBlock)(blocks[0]); + const isTemplate = blocks.length === 1 && (0,external_wp_blocks_namespaceObject.isTemplatePart)(blocks[0]); // Simple block tranformation based on the `Block Transforms` API. + + const onBlockTransform = name => replaceBlocks(clientIds, (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, name)); // Pattern transformation through the `Patterns` API. + + + const onPatternTransform = transformedBlocks => replaceBlocks(clientIds, transformedBlocks); + + const hasPossibleBlockTransformations = !!possibleBlockTransformations.length && canRemove; + const hasPatternTransformation = !!(patterns !== null && patterns !== void 0 && patterns.length) && canRemove; + + if (!hasBlockStyles && !hasPossibleBlockTransformations) { + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + disabled: true, + className: "block-editor-block-switcher__no-switcher-icon", + title: blockTitle, + icon: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(block_icon, { + icon: icon, + showColors: true + }), (isReusable || isTemplate) && (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-block-switcher__toggle-text" + }, (0,external_wp_element_namespaceObject.createElement)(BlockTitle, { + clientId: clientIds, + maximumLength: 35 + }))) + })); + } + + const blockSwitcherLabel = blockTitle; + const blockSwitcherDescription = 1 === blocks.length ? (0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %s: block title. */ + (0,external_wp_i18n_namespaceObject.__)('%s: Change block type or style'), blockTitle) : (0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %d: number of blocks. */ + (0,external_wp_i18n_namespaceObject._n)('Change type of %d block', 'Change type of %d blocks', blocks.length), blocks.length); + const showDropDown = hasBlockStyles || hasPossibleBlockTransformations || hasPatternTransformation; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, null, toggleProps => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, { + className: "block-editor-block-switcher", + label: blockSwitcherLabel, + popoverProps: { + position: 'bottom right', + isAlternate: true, + className: 'block-editor-block-switcher__popover' + }, + icon: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(block_icon, { + icon: icon, + className: "block-editor-block-switcher__toggle", + showColors: true + }), (isReusable || isTemplate) && (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-block-switcher__toggle-text" + }, (0,external_wp_element_namespaceObject.createElement)(BlockTitle, { + clientId: clientIds, + maximumLength: 35 + }))), + toggleProps: { + describedBy: blockSwitcherDescription, + ...toggleProps + }, + menuProps: { + orientation: 'both' + } + }, _ref3 => { + let { + onClose + } = _ref3; + return showDropDown && (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-switcher__container" + }, hasPatternTransformation && (0,external_wp_element_namespaceObject.createElement)(pattern_transformations_menu, { + blocks: blocks, + patterns: patterns, + onSelect: transformedBlocks => { + onPatternTransform(transformedBlocks); + onClose(); + } + }), hasPossibleBlockTransformations && (0,external_wp_element_namespaceObject.createElement)(block_transformations_menu, { + className: "block-editor-block-switcher__transforms__menugroup", + possibleBlockTransformations: possibleBlockTransformations, + blocks: blocks, + onSelect: name => { + onBlockTransform(name); + onClose(); + } + }), hasBlockStyles && (0,external_wp_element_namespaceObject.createElement)(BlockStylesMenu, { + hoveredBlock: blocks[0], + onSwitch: onClose + })); + }))); +}; +const BlockSwitcher = _ref4 => { + let { + clientIds + } = _ref4; + const blocks = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getBlocksByClientId(clientIds), [clientIds]); + + if (!blocks.length || blocks.some(block => !block)) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)(BlockSwitcherDropdownMenu, { + clientIds: clientIds, + blocks: blocks + }); +}; +/* harmony default export */ var block_switcher = (BlockSwitcher); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/block-toolbar-last-item.js +/** + * WordPress dependencies + */ + +const { + Fill: __unstableBlockToolbarLastItem, + Slot: block_toolbar_last_item_Slot +} = (0,external_wp_components_namespaceObject.createSlotFill)('__unstableBlockToolbarLastItem'); +__unstableBlockToolbarLastItem.Slot = block_toolbar_last_item_Slot; +/* harmony default export */ var block_toolbar_last_item = (__unstableBlockToolbarLastItem); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js + + +/** + * WordPress dependencies + */ + +const moreVertical = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" +})); +/* harmony default export */ var more_vertical = (moreVertical); + +;// CONCATENATED MODULE: external ["wp","blob"] +var external_wp_blob_namespaceObject = window["wp"]["blob"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/pasting.js +/** + * WordPress dependencies + */ + + +function getPasteEventData(_ref) { + let { + clipboardData + } = _ref; + let plainText = ''; + let 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; + } + } + + const files = (0,external_wp_dom_namespaceObject.getFilesFromDataTransfer)(clipboardData).filter(_ref2 => { + let { + type + } = _ref2; + return /^image\/(?:jpe?g|png|gif|webp)$/.test(type); + }); + + if (files.length && !shouldDismissPastedFiles(files, html, plainText)) { + html = files.map(file => ``).join(''); + plainText = ''; + } + + return { + html, + plainText + }; +} +/** + * Given a collection of DataTransfer files and HTML and plain text strings, + * determine whether the files are to be dismissed in favor of the HTML. + * + * Certain office-type programs, like Microsoft Word or Apple Numbers, + * will, upon copy, generate a screenshot of the content being copied and + * attach it to the clipboard alongside the actual rich text that the user + * sought to copy. In those cases, we should let Gutenberg handle the rich text + * content and not the screenshot, since this allows Gutenberg to insert + * meaningful blocks, like paragraphs, lists or even tables. + * + * @param {File[]} files File objects obtained from a paste event + * @param {string} html HTML content obtained from a paste event + * @return {boolean} True if the files should be dismissed + */ + +function shouldDismissPastedFiles(files, html +/*, plainText */ +) { + // The question is only relevant when there is actual HTML content and when + // there is exactly one image file. + if (html && (files === null || files === void 0 ? void 0 : files.length) === 1 && files[0].type.indexOf('image/') === 0) { + var _html$match; + + // A single tag found in the HTML source suggests that the + // content being pasted revolves around an image. Sometimes there are + // other elements found, like
, but we assume that the user's + // intention is to paste the actual image file. + const IMAGE_TAG = /<\s*img\b/gi; + return ((_html$match = html.match(IMAGE_TAG)) === null || _html$match === void 0 ? void 0 : _html$match.length) !== 1; + } + + return false; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/copy-handler/index.js + + +/** + * WordPress dependencies + */ + + + + + + + +/** + * Internal dependencies + */ + + + +function useNotifyCopy() { + const { + getBlockName + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const { + getBlockType + } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); + const { + createSuccessNotice + } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); + return (0,external_wp_element_namespaceObject.useCallback)((eventType, selectedBlockClientIds) => { + let notice = ''; + + if (selectedBlockClientIds.length === 1) { + var _getBlockType; + + const clientId = selectedBlockClientIds[0]; + const title = (_getBlockType = getBlockType(getBlockName(clientId))) === null || _getBlockType === void 0 ? void 0 : _getBlockType.title; + notice = eventType === 'copy' ? (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: Name of the block being copied, e.g. "Paragraph". + (0,external_wp_i18n_namespaceObject.__)('Copied "%s" to clipboard.'), title) : (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: Name of the block being cut, e.g. "Paragraph". + (0,external_wp_i18n_namespaceObject.__)('Moved "%s" to clipboard.'), title); + } else { + notice = eventType === 'copy' ? (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %d: Number of blocks being copied. + (0,external_wp_i18n_namespaceObject._n)('Copied %d block to clipboard.', 'Copied %d blocks to clipboard.', selectedBlockClientIds.length), selectedBlockClientIds.length) : (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %d: Number of blocks being cut. + (0,external_wp_i18n_namespaceObject._n)('Moved %d block to clipboard.', 'Moved %d blocks to clipboard.', selectedBlockClientIds.length), selectedBlockClientIds.length); + } + + createSuccessNotice(notice, { + type: 'snackbar' + }); + }, []); +} +function useClipboardHandler() { + const { + getBlocksByClientId, + getSelectedBlockClientIds, + hasMultiSelection, + getSettings, + __unstableIsFullySelected, + __unstableIsSelectionCollapsed, + __unstableIsSelectionMergeable, + __unstableGetSelectedBlocksWithPartialSelection + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const { + flashBlock, + removeBlocks, + replaceBlocks, + __unstableDeleteSelection, + __unstableExpandSelection + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const notifyCopy = useNotifyCopy(); + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { + function handler(event) { + const selectedBlockClientIds = getSelectedBlockClientIds(); + + if (selectedBlockClientIds.length === 0) { + return; + } // Always handle multiple selected blocks. + + + if (!hasMultiSelection()) { + const { + target + } = event; + const { + ownerDocument + } = target; // If copying, only consider actual text selection as selection. + // Otherwise, any focus on an input field is considered. + + const hasSelection = event.type === 'copy' || event.type === 'cut' ? (0,external_wp_dom_namespaceObject.documentHasUncollapsedSelection)(ownerDocument) : (0,external_wp_dom_namespaceObject.documentHasSelection)(ownerDocument); // Let native copy behaviour take over in input fields. + + if (hasSelection) { + return; + } + } + + if (!node.contains(event.target.ownerDocument.activeElement)) { + return; + } + + const eventDefaultPrevented = event.defaultPrevented; + event.preventDefault(); + + const isSelectionMergeable = __unstableIsSelectionMergeable(); + + const shouldHandleWholeBlocks = __unstableIsSelectionCollapsed() || __unstableIsFullySelected(); + + const expandSelectionIsNeeded = !shouldHandleWholeBlocks && !isSelectionMergeable; + + if (event.type === 'copy' || event.type === 'cut') { + if (selectedBlockClientIds.length === 1) { + flashBlock(selectedBlockClientIds[0]); + } // If we have a partial selection that is not mergeable, just + // expand the selection to the whole blocks. + + + if (expandSelectionIsNeeded) { + __unstableExpandSelection(); + } else { + notifyCopy(event.type, selectedBlockClientIds); + let blocks; // Check if we have partial selection. + + if (shouldHandleWholeBlocks) { + blocks = getBlocksByClientId(selectedBlockClientIds); + } else { + const [head, tail] = __unstableGetSelectedBlocksWithPartialSelection(); + + const inBetweenBlocks = getBlocksByClientId(selectedBlockClientIds.slice(1, selectedBlockClientIds.length - 1)); + blocks = [head, ...inBetweenBlocks, tail]; + } + + const serialized = (0,external_wp_blocks_namespaceObject.serialize)(blocks); + event.clipboardData.setData('text/plain', serialized); + event.clipboardData.setData('text/html', serialized); + } + } + + if (event.type === 'cut') { + // We need to also check if at the start we needed to + // expand the selection, as in this point we might have + // programmatically fully selected the blocks above. + if (shouldHandleWholeBlocks && !expandSelectionIsNeeded) { + removeBlocks(selectedBlockClientIds); + } else { + __unstableDeleteSelection(); + } + } else if (event.type === 'paste') { + if (eventDefaultPrevented) { + // This was likely already handled in rich-text/use-paste-handler.js. + return; + } + + const { + __experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML + } = getSettings(); + const { + plainText, + html + } = getPasteEventData(event); + const blocks = (0,external_wp_blocks_namespaceObject.pasteHandler)({ + HTML: html, + plainText, + mode: 'BLOCKS', + canUserUseUnfilteredHTML + }); + replaceBlocks(selectedBlockClientIds, blocks, blocks.length - 1, -1); + } + } + + node.ownerDocument.addEventListener('copy', handler); + node.ownerDocument.addEventListener('cut', handler); + node.ownerDocument.addEventListener('paste', handler); + return () => { + node.ownerDocument.removeEventListener('copy', handler); + node.ownerDocument.removeEventListener('cut', handler); + node.ownerDocument.removeEventListener('paste', handler); + }; + }, []); +} + +function CopyHandler(_ref) { + let { + children + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)("div", { + ref: useClipboardHandler() + }, children); +} +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/copy-handler/README.md + */ + + +/* harmony default export */ var copy_handler = (CopyHandler); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-actions/index.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + +function BlockActions(_ref) { + let { + clientIds, + children, + __experimentalUpdateSelection: updateSelection + } = _ref; + const { + canInsertBlockType, + getBlockRootClientId, + getBlocksByClientId, + canMoveBlocks, + canRemoveBlocks + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const { + getDefaultBlockName, + getGroupingBlockName + } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); + const blocks = getBlocksByClientId(clientIds); + const rootClientId = getBlockRootClientId(clientIds[0]); + const canDuplicate = (0,external_lodash_namespaceObject.every)(blocks, block => { + return !!block && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'multiple', true) && canInsertBlockType(block.name, rootClientId); + }); + const canInsertDefaultBlock = canInsertBlockType(getDefaultBlockName(), rootClientId); + const canMove = canMoveBlocks(clientIds, rootClientId); + const canRemove = canRemoveBlocks(clientIds, rootClientId); + const { + removeBlocks, + replaceBlocks, + duplicateBlocks, + insertAfterBlock, + insertBeforeBlock, + flashBlock, + setBlockMovingClientId, + setNavigationMode, + selectBlock + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const notifyCopy = useNotifyCopy(); + return children({ + canDuplicate, + canInsertDefaultBlock, + canMove, + canRemove, + rootClientId, + blocks, + + onDuplicate() { + return duplicateBlocks(clientIds, updateSelection); + }, + + onRemove() { + return removeBlocks(clientIds, updateSelection); + }, + + onInsertBefore() { + insertBeforeBlock((0,external_lodash_namespaceObject.first)((0,external_lodash_namespaceObject.castArray)(clientIds))); + }, + + onInsertAfter() { + insertAfterBlock((0,external_lodash_namespaceObject.last)((0,external_lodash_namespaceObject.castArray)(clientIds))); + }, + + onMoveTo() { + setNavigationMode(true); + selectBlock(clientIds[0]); + setBlockMovingClientId(clientIds[0]); + }, + + onGroup() { + if (!blocks.length) { + return; + } + + const groupingBlockName = getGroupingBlockName(); // Activate the `transform` on `core/group` which does the conversion. + + const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, groupingBlockName); + + if (!newBlocks) { + return; + } + + replaceBlocks(clientIds, newBlocks); + }, + + onUngroup() { + if (!blocks.length) { + return; + } + + const innerBlocks = blocks[0].innerBlocks; + + if (!innerBlocks.length) { + return; + } + + replaceBlocks(clientIds, innerBlocks); + }, + + onCopy() { + const selectedBlockClientIds = blocks.map(_ref2 => { + let { + clientId + } = _ref2; + return clientId; + }); + + if (blocks.length === 1) { + flashBlock(selectedBlockClientIds[0]); + } + + notifyCopy('copy', selectedBlockClientIds); + } + + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-mode-toggle.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + +function BlockModeToggle(_ref) { + let { + blockType, + mode, + onToggleMode, + small = false, + isCodeEditingEnabled = true + } = _ref; + + if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'html', true) || !isCodeEditingEnabled) { + return null; + } + + const label = mode === 'visual' ? (0,external_wp_i18n_namespaceObject.__)('Edit as HTML') : (0,external_wp_i18n_namespaceObject.__)('Edit visually'); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + onClick: onToggleMode + }, !small && label); +} +/* harmony default export */ var block_mode_toggle = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, _ref2) => { + let { + clientId + } = _ref2; + const { + getBlock, + getBlockMode, + getSettings + } = select(store); + const block = getBlock(clientId); + const isCodeEditingEnabled = getSettings().codeEditingEnabled; + return { + mode: getBlockMode(clientId), + blockType: block ? (0,external_wp_blocks_namespaceObject.getBlockType)(block.name) : null, + isCodeEditingEnabled + }; +}), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref3) => { + let { + onToggle = external_lodash_namespaceObject.noop, + clientId + } = _ref3; + return { + onToggleMode() { + dispatch(store).toggleBlockMode(clientId); + onToggle(); + } + + }; +})])(BlockModeToggle)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-convert-button.js + + +/** + * WordPress dependencies + */ + + +function BlockConvertButton(_ref) { + let { + shouldRender, + onClick, + small + } = _ref; + + if (!shouldRender) { + return null; + } + + const label = (0,external_wp_i18n_namespaceObject.__)('Convert to Blocks'); + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + onClick: onClick + }, !small && label); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-html-convert-button.js +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + +/* harmony default export */ var block_html_convert_button = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, _ref) => { + let { + clientId + } = _ref; + const block = select(store).getBlock(clientId); + return { + block, + shouldRender: block && block.name === 'core/html' + }; +}), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref2) => { + let { + block + } = _ref2; + return { + onClick: () => dispatch(store).replaceBlocks(block.clientId, (0,external_wp_blocks_namespaceObject.rawHandler)({ + HTML: (0,external_wp_blocks_namespaceObject.getBlockContent)(block) + })) + }; +}))(BlockConvertButton)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-settings-menu-first-item.js +/** + * WordPress dependencies + */ + +const { + Fill: __unstableBlockSettingsMenuFirstItem, + Slot: block_settings_menu_first_item_Slot +} = (0,external_wp_components_namespaceObject.createSlotFill)('__unstableBlockSettingsMenuFirstItem'); +__unstableBlockSettingsMenuFirstItem.Slot = block_settings_menu_first_item_Slot; +/* harmony default export */ var block_settings_menu_first_item = (__unstableBlockSettingsMenuFirstItem); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/index.js + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + + +function ConvertToGroupButton(_ref) { + let { + clientIds, + isGroupable, + isUngroupable, + blocksSelection, + groupingBlockName, + onClose = () => {} + } = _ref; + const { + replaceBlocks + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + + const onConvertToGroup = () => { + // Activate the `transform` on the Grouping Block which does the conversion. + const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocksSelection, groupingBlockName); + + if (newBlocks) { + replaceBlocks(clientIds, newBlocks); + } + }; + + const onConvertFromGroup = () => { + const innerBlocks = blocksSelection[0].innerBlocks; + + if (!innerBlocks.length) { + return; + } + + replaceBlocks(clientIds, innerBlocks); + }; + + if (!isGroupable && !isUngroupable) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isGroupable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + onClick: () => { + onConvertToGroup(); + onClose(); + } + }, (0,external_wp_i18n_namespaceObject._x)('Group', 'verb')), isUngroupable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + onClick: () => { + onConvertFromGroup(); + onClose(); + } + }, (0,external_wp_i18n_namespaceObject._x)('Ungroup', 'Ungrouping blocks from within a Group block back into individual blocks within the Editor '))); +} + + + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +/** + * Contains the properties `ConvertToGroupButton` component needs. + * + * @typedef {Object} ConvertToGroupButtonProps + * @property {string[]} clientIds An array of the selected client ids. + * @property {boolean} isGroupable Indicates if the selected blocks can be grouped. + * @property {boolean} isUngroupable Indicates if the selected blocks can be ungrouped. + * @property {WPBlock[]} blocksSelection An array of the selected blocks. + * @property {string} groupingBlockName The name of block used for handling grouping interactions. + */ + +/** + * Returns the properties `ConvertToGroupButton` component needs to work properly. + * It is used in `BlockSettingsMenuControls` to know if `ConvertToGroupButton` + * should be rendered, to avoid ending up with an empty MenuGroup. + * + * @return {ConvertToGroupButtonProps} Returns the properties needed by `ConvertToGroupButton`. + */ + +function useConvertToGroupButtonProps() { const { clientIds, - rootClientId - } = Object(external_wp_data_["useSelect"])(select => { - const { - getSelectedBlockClientIds, + isGroupable, + isUngroupable, + blocksSelection, + groupingBlockName + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + var _blocksSelection$; + + const { + getBlockRootClientId, + getBlocksByClientId, + canInsertBlockType, + getSelectedBlockClientIds + } = select(store); + const { + getGroupingBlockName + } = select(external_wp_blocks_namespaceObject.store); + + const _clientIds = getSelectedBlockClientIds(); + + const _groupingBlockName = getGroupingBlockName(); + + const rootClientId = !!(_clientIds !== null && _clientIds !== void 0 && _clientIds.length) ? getBlockRootClientId(_clientIds[0]) : undefined; + const groupingBlockAvailable = canInsertBlockType(_groupingBlockName, rootClientId); + + const _blocksSelection = getBlocksByClientId(_clientIds); + + const isSingleGroupingBlock = _blocksSelection.length === 1 && ((_blocksSelection$ = _blocksSelection[0]) === null || _blocksSelection$ === void 0 ? void 0 : _blocksSelection$.name) === _groupingBlockName; // Do we have + // 1. Grouping block available to be inserted? + // 2. One or more blocks selected + + const _isGroupable = groupingBlockAvailable && _blocksSelection.length; // Do we have a single Group Block selected and does that group have inner blocks? + + + const _isUngroupable = isSingleGroupingBlock && !!_blocksSelection[0].innerBlocks.length; + + return { + clientIds: _clientIds, + isGroupable: _isGroupable, + isUngroupable: _isUngroupable, + blocksSelection: _blocksSelection, + groupingBlockName: _groupingBlockName + }; + }, []); + return { + clientIds, + isGroupable, + isUngroupable, + blocksSelection, + groupingBlockName + }; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/unlock.js + + +/** + * WordPress dependencies + */ + +const unlock = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8h1.5c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1z" +})); +/* harmony default export */ var library_unlock = (unlock); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/lock.js + + +/** + * WordPress dependencies + */ + +const lock = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zm-2.8 0H9.8V7c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3z" +})); +/* harmony default export */ var library_lock = (lock); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-lock/use-block-lock.js +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + +/** + * Return details about the block lock status. + * + * @param {string} clientId The block client Id. + * + * @return {Object} Block lock status + */ + +function useBlockLock(clientId) { + return (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + canMoveBlock, + canRemoveBlock, + canLockBlockType, + getBlockName, getBlockRootClientId } = select(store); - const selectedClientIds = getSelectedBlockClientIds(); - const [firstClientId] = selectedClientIds; - return { - clientIds: selectedClientIds, - rootClientId: getBlockRootClientId(firstClientId) + const rootClientId = getBlockRootClientId(clientId); + const canMove = canMoveBlock(clientId, rootClientId); + const canRemove = canRemoveBlock(clientId, rootClientId); + return { + canMove, + canRemove, + canLock: canLockBlockType(getBlockName(clientId)), + isLocked: !canMove || !canRemove + }; + }, [clientId]); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-lock/modal.js + + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + + +function BlockLockModal(_ref) { + let { + clientId, + onClose + } = _ref; + const [lock, setLock] = (0,external_wp_element_namespaceObject.useState)({ + move: false, + remove: false + }); + const { + canMove, + canRemove + } = useBlockLock(clientId); + const { + updateBlockAttributes + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const blockInformation = useBlockDisplayInformation(clientId); + const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockLockModal, 'block-editor-block-lock-modal__options-title'); + (0,external_wp_element_namespaceObject.useEffect)(() => { + setLock({ + move: !canMove, + remove: !canRemove + }); + }, [canMove, canRemove]); + const isAllChecked = Object.values(lock).every(Boolean); + const isMixed = Object.values(lock).some(Boolean) && !isAllChecked; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { + title: (0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %s: Name of the block. */ + (0,external_wp_i18n_namespaceObject.__)('Lock %s'), blockInformation.title), + overlayClassName: "block-editor-block-lock-modal", + closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), + onRequestClose: onClose + }, (0,external_wp_element_namespaceObject.createElement)("form", { + onSubmit: event => { + event.preventDefault(); + updateBlockAttributes([clientId], { + lock + }); + onClose(); + } + }, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Choose specific attributes to restrict or lock all available options.')), (0,external_wp_element_namespaceObject.createElement)("div", { + role: "group", + "aria-labelledby": instanceId, + className: "block-editor-block-lock-modal__options" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { + className: "block-editor-block-lock-modal__options-title", + label: (0,external_wp_element_namespaceObject.createElement)("span", { + id: instanceId + }, (0,external_wp_i18n_namespaceObject.__)('Lock all')), + checked: isAllChecked, + indeterminate: isMixed, + onChange: newValue => setLock({ + move: newValue, + remove: newValue + }) + }), (0,external_wp_element_namespaceObject.createElement)("ul", { + className: "block-editor-block-lock-modal__checklist" + }, (0,external_wp_element_namespaceObject.createElement)("li", { + className: "block-editor-block-lock-modal__checklist-item" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { + label: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('Disable movement'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { + icon: lock.move ? library_lock : library_unlock + })), + checked: lock.move, + onChange: move => setLock(prevLock => ({ ...prevLock, + move + })) + })), (0,external_wp_element_namespaceObject.createElement)("li", { + className: "block-editor-block-lock-modal__checklist-item" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { + label: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('Prevent removal'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { + icon: lock.remove ? library_lock : library_unlock + })), + checked: lock.remove, + onChange: remove => setLock(prevLock => ({ ...prevLock, + remove + })) + })))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { + className: "block-editor-block-lock-modal__actions", + justify: "flex-end", + expanded: false + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + variant: "tertiary", + onClick: onClose + }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + variant: "primary", + type: "submit" + }, (0,external_wp_i18n_namespaceObject.__)('Apply')))))); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-lock/menu-item.js + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + +function BlockLockMenuItem(_ref) { + let { + clientId + } = _ref; + const { + canLock, + isLocked + } = useBlockLock(clientId); + const [isModalOpen, toggleModal] = (0,external_wp_element_namespaceObject.useReducer)(isActive => !isActive, false); + + if (!canLock) { + return null; + } + + const label = isLocked ? (0,external_wp_i18n_namespaceObject.__)('Unlock') : (0,external_wp_i18n_namespaceObject.__)('Lock'); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + icon: isLocked ? library_unlock : library_lock, + onClick: toggleModal + }, label), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(BlockLockModal, { + clientId: clientId, + onClose: toggleModal + })); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu-controls/index.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + +const { + Fill, + Slot: block_settings_menu_controls_Slot +} = (0,external_wp_components_namespaceObject.createSlotFill)('BlockSettingsMenuControls'); + +const BlockSettingsMenuControlsSlot = _ref => { + let { + fillProps, + clientIds = null + } = _ref; + const { + selectedBlocks, + selectedClientIds, + canRemove + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getBlocksByClientId, + getSelectedBlockClientIds, + canRemoveBlocks + } = select(store); + const ids = clientIds !== null ? clientIds : getSelectedBlockClientIds(); + return { + selectedBlocks: (0,external_lodash_namespaceObject.map)((0,external_lodash_namespaceObject.compact)(getBlocksByClientId(ids)), block => block.name), + selectedClientIds: ids, + canRemove: canRemoveBlocks(ids) + }; + }, [clientIds]); + const showLockButton = selectedClientIds.length === 1; // Check if current selection of blocks is Groupable or Ungroupable + // and pass this props down to ConvertToGroupButton. + + const convertToGroupButtonProps = useConvertToGroupButtonProps(); + const { + isGroupable, + isUngroupable + } = convertToGroupButtonProps; + const showConvertToGroupButton = (isGroupable || isUngroupable) && canRemove; + return (0,external_wp_element_namespaceObject.createElement)(block_settings_menu_controls_Slot, { + fillProps: { ...fillProps, + selectedBlocks, + selectedClientIds + } + }, fills => { + if (!(fills !== null && fills !== void 0 && fills.length) > 0 && !showConvertToGroupButton && !showLockButton) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, showLockButton && (0,external_wp_element_namespaceObject.createElement)(BlockLockMenuItem, { + clientId: selectedClientIds[0] + }), fills, showConvertToGroupButton && (0,external_wp_element_namespaceObject.createElement)(ConvertToGroupButton, _extends({}, convertToGroupButtonProps, { + onClose: fillProps === null || fillProps === void 0 ? void 0 : fillProps.onClose + }))); + }); +}; +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-settings-menu-controls/README.md + * + * @param {Object} props Fill props. + * @return {WPElement} Element. + */ + + +function BlockSettingsMenuControls(_ref2) { + let { ...props + } = _ref2; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalStyleProvider, { + document: document + }, (0,external_wp_element_namespaceObject.createElement)(Fill, props)); +} + +BlockSettingsMenuControls.Slot = BlockSettingsMenuControlsSlot; +/* harmony default export */ var block_settings_menu_controls = (BlockSettingsMenuControls); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-settings-dropdown.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + + + + +/** + * Internal dependencies + */ + + + + + + + + + + +const block_settings_dropdown_POPOVER_PROPS = { + className: 'block-editor-block-settings-menu__popover', + position: 'bottom right', + isAlternate: true +}; + +function CopyMenuItem(_ref) { + let { + blocks, + onCopy + } = _ref; + const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(() => (0,external_wp_blocks_namespaceObject.serialize)(blocks), onCopy); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + ref: ref + }, (0,external_wp_i18n_namespaceObject.__)('Copy')); +} + +function BlockSettingsDropdown(_ref2) { + let { + clientIds, + __experimentalSelectBlock, + children, + ...props + } = _ref2; + const blockClientIds = (0,external_lodash_namespaceObject.castArray)(clientIds); + const count = blockClientIds.length; + const firstBlockClientId = blockClientIds[0]; + const { + firstParentClientId, + hasReducedUI, + onlyBlock, + parentBlockType, + previousBlockClientId, + nextBlockClientId, + selectedBlockClientIds + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getBlockCount, + getBlockName, + getBlockParents, + getPreviousBlockClientId, + getNextBlockClientId, + getSelectedBlockClientIds, + getSettings + } = select(store); + const parents = getBlockParents(firstBlockClientId); + const _firstParentClientId = parents[parents.length - 1]; + const parentBlockName = getBlockName(_firstParentClientId); + return { + firstParentClientId: _firstParentClientId, + hasReducedUI: getSettings().hasReducedUI, + onlyBlock: 1 === getBlockCount(), + parentBlockType: (0,external_wp_blocks_namespaceObject.getBlockType)(parentBlockName), + previousBlockClientId: getPreviousBlockClientId(firstBlockClientId), + nextBlockClientId: getNextBlockClientId(firstBlockClientId), + selectedBlockClientIds: getSelectedBlockClientIds() + }; + }, [firstBlockClientId]); + const shortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getShortcutRepresentation + } = select(external_wp_keyboardShortcuts_namespaceObject.store); + return { + duplicate: getShortcutRepresentation('core/block-editor/duplicate'), + remove: getShortcutRepresentation('core/block-editor/remove'), + insertAfter: getShortcutRepresentation('core/block-editor/insert-after'), + insertBefore: getShortcutRepresentation('core/block-editor/insert-before') + }; + }, []); + const { + selectBlock, + toggleBlockHighlight + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const updateSelectionAfterDuplicate = (0,external_wp_element_namespaceObject.useCallback)(__experimentalSelectBlock ? async clientIdsPromise => { + const ids = await clientIdsPromise; + + if (ids && ids[0]) { + __experimentalSelectBlock(ids[0]); + } + } : external_lodash_namespaceObject.noop, [__experimentalSelectBlock]); + const blockTitle = useBlockDisplayTitle(firstBlockClientId, 25); + const updateSelectionAfterRemove = (0,external_wp_element_namespaceObject.useCallback)(__experimentalSelectBlock ? () => { + const blockToSelect = previousBlockClientId || nextBlockClientId; + + if (blockToSelect && // From the block options dropdown, it's possible to remove a block that is not selected, + // in this case, it's not necessary to update the selection since the selected block wasn't removed. + selectedBlockClientIds.includes(firstBlockClientId) && // Don't update selection when next/prev block also is in the selection ( and gets removed ), + // In case someone selects all blocks and removes them at once. + !selectedBlockClientIds.includes(blockToSelect)) { + __experimentalSelectBlock(blockToSelect); + } + } : external_lodash_namespaceObject.noop, [__experimentalSelectBlock, previousBlockClientId, nextBlockClientId, selectedBlockClientIds]); + const label = (0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %s: block name */ + (0,external_wp_i18n_namespaceObject.__)('Remove %s'), blockTitle); + const removeBlockLabel = count === 1 ? label : (0,external_wp_i18n_namespaceObject.__)('Remove blocks'); // Allows highlighting the parent block outline when focusing or hovering + // the parent block selector within the child. + + const selectParentButtonRef = (0,external_wp_element_namespaceObject.useRef)(); + const { + gestures: showParentOutlineGestures + } = useShowMoversGestures({ + ref: selectParentButtonRef, + + onChange(isFocused) { + if (isFocused && hasReducedUI) { + return; + } + + toggleBlockHighlight(firstParentClientId, isFocused); + } + + }); + return (0,external_wp_element_namespaceObject.createElement)(BlockActions, { + clientIds: clientIds, + __experimentalUpdateSelection: !__experimentalSelectBlock + }, _ref3 => { + let { + canDuplicate, + canInsertDefaultBlock, + canMove, + canRemove, + onDuplicate, + onInsertAfter, + onInsertBefore, + onRemove, + onCopy, + onMoveTo, + blocks + } = _ref3; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, _extends({ + icon: more_vertical, + label: (0,external_wp_i18n_namespaceObject.__)('Options'), + className: "block-editor-block-settings-menu", + popoverProps: block_settings_dropdown_POPOVER_PROPS, + noIcons: true + }, props), _ref4 => { + let { + onClose + } = _ref4; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(block_settings_menu_first_item.Slot, { + fillProps: { + onClose + } + }), firstParentClientId !== undefined && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, _extends({}, showParentOutlineGestures, { + ref: selectParentButtonRef, + icon: (0,external_wp_element_namespaceObject.createElement)(block_icon, { + icon: parentBlockType.icon + }), + onClick: () => selectBlock(firstParentClientId) + }), (0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %s: Name of the block's parent. */ + (0,external_wp_i18n_namespaceObject.__)('Select parent block (%s)'), parentBlockType.title)), count === 1 && (0,external_wp_element_namespaceObject.createElement)(block_html_convert_button, { + clientId: firstBlockClientId + }), (0,external_wp_element_namespaceObject.createElement)(CopyMenuItem, { + blocks: blocks, + onCopy: onCopy + }), canDuplicate && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + onClick: (0,external_lodash_namespaceObject.flow)(onClose, onDuplicate, updateSelectionAfterDuplicate), + shortcut: shortcuts.duplicate + }, (0,external_wp_i18n_namespaceObject.__)('Duplicate')), canInsertDefaultBlock && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + onClick: (0,external_lodash_namespaceObject.flow)(onClose, onInsertBefore), + shortcut: shortcuts.insertBefore + }, (0,external_wp_i18n_namespaceObject.__)('Insert before')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + onClick: (0,external_lodash_namespaceObject.flow)(onClose, onInsertAfter), + shortcut: shortcuts.insertAfter + }, (0,external_wp_i18n_namespaceObject.__)('Insert after'))), canMove && !onlyBlock && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + onClick: (0,external_lodash_namespaceObject.flow)(onClose, onMoveTo) + }, (0,external_wp_i18n_namespaceObject.__)('Move to')), count === 1 && (0,external_wp_element_namespaceObject.createElement)(block_mode_toggle, { + clientId: firstBlockClientId, + onToggle: onClose + })), (0,external_wp_element_namespaceObject.createElement)(block_settings_menu_controls.Slot, { + fillProps: { + onClose + }, + clientIds: clientIds + }), typeof children === 'function' ? children({ + onClose + }) : external_wp_element_namespaceObject.Children.map(child => (0,external_wp_element_namespaceObject.cloneElement)(child, { + onClose + })), canRemove && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + onClick: (0,external_lodash_namespaceObject.flow)(onClose, onRemove, updateSelectionAfterRemove), + shortcut: shortcuts.remove + }, removeBlockLabel))); + }); + }); +} +/* harmony default export */ var block_settings_dropdown = (BlockSettingsDropdown); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/index.js + + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + +function BlockSettingsMenu(_ref) { + let { + clientIds, + ...props + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, null, toggleProps => (0,external_wp_element_namespaceObject.createElement)(block_settings_dropdown, _extends({ + clientIds: clientIds, + toggleProps: toggleProps + }, props)))); +} +/* harmony default export */ var block_settings_menu = (BlockSettingsMenu); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-lock/toolbar.js + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + +function BlockLockToolbar(_ref) { + let { + clientId + } = _ref; + const blockInformation = useBlockDisplayInformation(clientId); + const { + canMove, + canRemove, + canLock + } = useBlockLock(clientId); + const [isModalOpen, toggleModal] = (0,external_wp_element_namespaceObject.useReducer)(isActive => !isActive, false); + + if (!canLock) { + return null; + } + + if (canMove && canRemove) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, { + className: "block-editor-block-lock-toolbar" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + icon: library_lock, + label: (0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %s: block name */ + (0,external_wp_i18n_namespaceObject.__)('Unlock %s'), blockInformation.title), + onClick: toggleModal + })), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(BlockLockModal, { + clientId: clientId, + onClose: toggleModal + })); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/group.js + + +/** + * WordPress dependencies + */ + +const group_group = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M18 4h-7c-1.1 0-2 .9-2 2v3H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-3h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h3V13c0 1.1.9 2 2 2h2.5v3zm0-4.5H11c-.3 0-.5-.2-.5-.5v-2.5H13c.3 0 .5.2.5.5v2.5zm5-.5c0 .3-.2.5-.5.5h-3V11c0-1.1-.9-2-2-2h-2.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7z" +})); +/* harmony default export */ var library_group = (group_group); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/row.js + + +/** + * WordPress dependencies + */ + +const row = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M9.2 6.5H4V8h5.2c.3 0 .5.2.5.5v7c0 .3-.2.5-.5.5H4v1.5h5.2c1.1 0 2-.9 2-2v-7c0-1.1-.8-2-2-2zM14.8 8H20V6.5h-5.2c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2H20V16h-5.2c-.3 0-.5-.2-.5-.5v-7c-.1-.3.2-.5.5-.5z" +})); +/* harmony default export */ var library_row = (row); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/stack.js + + +/** + * WordPress dependencies + */ + +const stack = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M16 4v5.2c0 .3-.2.5-.5.5h-7c-.3.1-.5-.2-.5-.5V4H6.5v5.2c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2V4H16zm-.5 8.8h-7c-1.1 0-2 .9-2 2V20H8v-5.2c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5V20h1.5v-5.2c0-1.2-.9-2-2-2z" +})); +/* harmony default export */ var library_stack = (stack); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/toolbar.js + + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + +const layouts = { + group: undefined, + row: { + type: 'flex', + flexWrap: 'nowrap' + }, + stack: { + type: 'flex', + orientation: 'vertical' + } +}; + +function BlockGroupToolbar() { + const { + blocksSelection, + clientIds, + groupingBlockName, + isGroupable + } = useConvertToGroupButtonProps(); + const { + replaceBlocks + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const { + canRemove + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + canRemoveBlocks + } = select(store); + return { + canRemove: canRemoveBlocks(clientIds) + }; + }, [clientIds]); + + const onConvertToGroup = function () { + let layout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'group'; + const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocksSelection, groupingBlockName); + + if (newBlocks && newBlocks.length > 0) { + // Because the block is not in the store yet we can't use + // updateBlockAttributes so need to manually update attributes. + newBlocks[0].attributes.layout = layouts[layout]; + replaceBlocks(clientIds, newBlocks); + } + }; + + const onConvertToRow = () => onConvertToGroup('row'); + + const onConvertToStack = () => onConvertToGroup('stack'); // Don't render the button if the current selection cannot be grouped. + // A good example is selecting multiple button blocks within a Buttons block: + // The group block is not a valid child of Buttons, so we should not show the button. + // Any blocks that are locked against removal also cannot be grouped. + + + if (!isGroupable || !canRemove) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + icon: library_group, + label: (0,external_wp_i18n_namespaceObject._x)('Group', 'verb'), + onClick: onConvertToGroup + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + icon: library_row, + label: (0,external_wp_i18n_namespaceObject._x)('Row', 'single horizontal line'), + onClick: onConvertToRow + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + icon: library_stack, + label: (0,external_wp_i18n_namespaceObject._x)('Stack', 'verb'), + onClick: onConvertToStack + })); +} + +/* harmony default export */ var toolbar = (BlockGroupToolbar); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/block-name-context.js +/** + * WordPress dependencies + */ + + +const __unstableBlockNameContext = (0,external_wp_element_namespaceObject.createContext)(''); + +/* harmony default export */ var block_name_context = (__unstableBlockNameContext); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/index.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + + + + + + + + + + + +const BlockToolbar = _ref => { + let { + hideDragHandle + } = _ref; + const { + blockClientIds, + blockClientId, + blockType, + hasFixedToolbar, + hasReducedUI, + isValid, + isVisual + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getBlockName, + getBlockMode, + getSelectedBlockClientIds, + isBlockValid, + getBlockRootClientId, + getSettings + } = select(store); + const selectedBlockClientIds = getSelectedBlockClientIds(); + const selectedBlockClientId = selectedBlockClientIds[0]; + const blockRootClientId = getBlockRootClientId(selectedBlockClientId); + const settings = getSettings(); + return { + blockClientIds: selectedBlockClientIds, + blockClientId: selectedBlockClientId, + blockType: selectedBlockClientId && (0,external_wp_blocks_namespaceObject.getBlockType)(getBlockName(selectedBlockClientId)), + hasFixedToolbar: settings.hasFixedToolbar, + hasReducedUI: settings.hasReducedUI, + rootClientId: blockRootClientId, + isValid: selectedBlockClientIds.every(id => isBlockValid(id)), + isVisual: selectedBlockClientIds.every(id => getBlockMode(id) === 'visual') + }; + }, []); // Handles highlighting the current block outline on hover or focus of the + // block type toolbar area. + + const { + toggleBlockHighlight + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const nodeRef = (0,external_wp_element_namespaceObject.useRef)(); + const { + showMovers, + gestures: showMoversGestures + } = useShowMoversGestures({ + ref: nodeRef, + + onChange(isFocused) { + if (isFocused && hasReducedUI) { + return; + } + + toggleBlockHighlight(blockClientId, isFocused); + } + + }); // Account for the cases where the block toolbar is rendered within the + // header area and not contextually to the block. + + const displayHeaderToolbar = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<') || hasFixedToolbar; + + if (blockType) { + if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, '__experimentalToolbar', true)) { + return null; + } + } + + const shouldShowMovers = displayHeaderToolbar || showMovers; + + if (blockClientIds.length === 0) { + return null; + } + + const shouldShowVisualToolbar = isValid && isVisual; + const isMultiToolbar = blockClientIds.length > 1; + const classes = classnames_default()('block-editor-block-toolbar', shouldShowMovers && 'is-showing-movers'); + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: classes + }, !isMultiToolbar && !displayHeaderToolbar && (0,external_wp_element_namespaceObject.createElement)(BlockParentSelector, { + clientIds: blockClientIds + }), (0,external_wp_element_namespaceObject.createElement)("div", _extends({ + ref: nodeRef + }, showMoversGestures), (shouldShowVisualToolbar || isMultiToolbar) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, { + className: "block-editor-block-toolbar__block-controls" + }, (0,external_wp_element_namespaceObject.createElement)(block_switcher, { + clientIds: blockClientIds + }), !isMultiToolbar && (0,external_wp_element_namespaceObject.createElement)(BlockLockToolbar, { + clientId: blockClientIds[0] + }), (0,external_wp_element_namespaceObject.createElement)(block_mover, { + clientIds: blockClientIds, + hideDragHandle: hideDragHandle || hasReducedUI + }))), shouldShowVisualToolbar && isMultiToolbar && (0,external_wp_element_namespaceObject.createElement)(toolbar, null), shouldShowVisualToolbar && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(block_controls.Slot, { + group: "parent", + className: "block-editor-block-toolbar__slot" + }), (0,external_wp_element_namespaceObject.createElement)(block_controls.Slot, { + group: "block", + className: "block-editor-block-toolbar__slot" + }), (0,external_wp_element_namespaceObject.createElement)(block_controls.Slot, { + className: "block-editor-block-toolbar__slot" + }), (0,external_wp_element_namespaceObject.createElement)(block_controls.Slot, { + group: "inline", + className: "block-editor-block-toolbar__slot" + }), (0,external_wp_element_namespaceObject.createElement)(block_controls.Slot, { + group: "other", + className: "block-editor-block-toolbar__slot" + }), (0,external_wp_element_namespaceObject.createElement)(block_name_context.Provider, { + value: blockType === null || blockType === void 0 ? void 0 : blockType.name + }, (0,external_wp_element_namespaceObject.createElement)(block_toolbar_last_item.Slot, null))), (0,external_wp_element_namespaceObject.createElement)(block_settings_menu, { + clientIds: blockClientIds + })); +}; +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md + */ + + +/* harmony default export */ var block_toolbar = (BlockToolbar); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/block-contextual-toolbar.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + + +function BlockContextualToolbar(_ref) { + let { + focusOnMount, + isFixed, + ...props + } = _ref; + const { + blockType, + hasParents, + showParentSelector + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getBlockName, + getBlockParents, + getSelectedBlockClientIds + } = select(store); + const { + getBlockType + } = select(external_wp_blocks_namespaceObject.store); + const selectedBlockClientIds = getSelectedBlockClientIds(); + const selectedBlockClientId = selectedBlockClientIds[0]; + const parents = getBlockParents(selectedBlockClientId); + const firstParentClientId = parents[parents.length - 1]; + const parentBlockName = getBlockName(firstParentClientId); + const parentBlockType = getBlockType(parentBlockName); + return { + blockType: selectedBlockClientId && getBlockType(getBlockName(selectedBlockClientId)), + hasParents: parents.length, + showParentSelector: (0,external_wp_blocks_namespaceObject.hasBlockSupport)(parentBlockType, '__experimentalParentSelector', true) && selectedBlockClientIds.length <= 1 + }; + }, []); + + if (blockType) { + if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, '__experimentalToolbar', true)) { + return null; + } + } // Shifts the toolbar to make room for the parent block selector. + + + const classes = classnames_default()('block-editor-block-contextual-toolbar', { + 'has-parent': hasParents && showParentSelector, + 'is-fixed': isFixed + }); + return (0,external_wp_element_namespaceObject.createElement)(navigable_toolbar, _extends({ + focusOnMount: focusOnMount, + className: classes + /* translators: accessibility text for the block toolbar */ + , + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Block tools') + }, props), (0,external_wp_element_namespaceObject.createElement)(block_toolbar, { + hideDragHandle: isFixed + })); +} + +/* harmony default export */ var block_contextual_toolbar = (BlockContextualToolbar); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/block-popover.js + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + + + + +/** + * Internal dependencies + */ + + + + + + + + +function block_popover_selector(select) { + const { + isNavigationMode, + isMultiSelecting, + hasMultiSelection, + isTyping, + isCaretWithinFormattedText, + getSettings, + getLastMultiSelectedBlockClientId + } = select(store); + return { + isNavigationMode: isNavigationMode(), + isMultiSelecting: isMultiSelecting(), + isTyping: isTyping(), + isCaretWithinFormattedText: isCaretWithinFormattedText(), + hasMultiSelection: hasMultiSelection(), + hasFixedToolbar: getSettings().hasFixedToolbar, + lastClientId: getLastMultiSelectedBlockClientId() + }; +} + +function BlockPopover(_ref) { + let { + clientId, + rootClientId, + isValid, + isEmptyDefaultBlock, + capturingClientId, + __unstablePopoverSlot, + __unstableContentRef + } = _ref; + const { + isNavigationMode, + isMultiSelecting, + isTyping, + isCaretWithinFormattedText, + hasMultiSelection, + hasFixedToolbar, + lastClientId + } = (0,external_wp_data_namespaceObject.useSelect)(block_popover_selector, []); + const isInsertionPointVisible = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + isBlockInsertionPointVisible, + getBlockInsertionPoint, + getBlockOrder + } = select(store); + + if (!isBlockInsertionPointVisible()) { + return false; + } + + const insertionPoint = getBlockInsertionPoint(); + const order = getBlockOrder(insertionPoint.rootClientId); + return order[insertionPoint.index] === clientId; + }, [clientId]); + const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); + const [isToolbarForced, setIsToolbarForced] = (0,external_wp_element_namespaceObject.useState)(false); + const [isInserterShown, setIsInserterShown] = (0,external_wp_element_namespaceObject.useState)(false); + const { + stopTyping + } = (0,external_wp_data_namespaceObject.useDispatch)(store); // Controls when the side inserter on empty lines should + // be shown, including writing and selection modes. + + const showEmptyBlockSideInserter = !isTyping && !isNavigationMode && isEmptyDefaultBlock && isValid; + const shouldShowBreadcrumb = isNavigationMode; + const shouldShowContextualToolbar = !isNavigationMode && !hasFixedToolbar && isLargeViewport && !showEmptyBlockSideInserter && !isMultiSelecting && (!isTyping || isCaretWithinFormattedText); + const canFocusHiddenToolbar = !isNavigationMode && !shouldShowContextualToolbar && !hasFixedToolbar && !isEmptyDefaultBlock; + (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/block-editor/focus-toolbar', () => { + setIsToolbarForced(true); + stopTyping(true); + }, { + isDisabled: !canFocusHiddenToolbar + }); + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (!shouldShowContextualToolbar) { + setIsToolbarForced(false); + } + }, [shouldShowContextualToolbar]); // Stores the active toolbar item index so the block toolbar can return focus + // to it when re-mounting. + + const initialToolbarItemIndexRef = (0,external_wp_element_namespaceObject.useRef)(); + const selectedElement = useBlockElement(clientId); + const lastSelectedElement = useBlockElement(lastClientId); + const capturingElement = useBlockElement(capturingClientId); + const popoverScrollRef = usePopoverScroll(__unstableContentRef); + + if (!shouldShowBreadcrumb && !shouldShowContextualToolbar && !isToolbarForced && !showEmptyBlockSideInserter) { + return null; + } + + let node = selectedElement; + + if (!node) { + return null; + } + + if (capturingClientId) { + node = capturingElement; + } + + let anchorRef = node; + + if (hasMultiSelection) { + // Wait to render the popover until the bottom reference is available + // as well. + if (!lastSelectedElement) { + return null; + } + + anchorRef = { + top: node, + bottom: lastSelectedElement + }; + } + + function onFocus() { + setIsInserterShown(true); + } + + function onBlur() { + setIsInserterShown(false); + } // Position above the anchor, pop out towards the right, and position in the + // left corner. For the side inserter, pop out towards the left, and + // position in the right corner. + // To do: refactor `Popover` to make this prop clearer. + + + const popoverPosition = showEmptyBlockSideInserter ? 'top left right' : 'top right left'; + const { + ownerDocument + } = node; + const stickyBoundaryElement = showEmptyBlockSideInserter ? undefined : // The sticky boundary element should be the boundary at which the + // the block toolbar becomes sticky when the block scolls out of view. + // In case of an iframe, this should be the iframe boundary, otherwise + // the scroll container. + ownerDocument.defaultView.frameElement || (0,external_wp_dom_namespaceObject.getScrollContainer)(node) || ownerDocument.body; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, { + ref: popoverScrollRef, + noArrow: true, + animate: false, + position: popoverPosition, + focusOnMount: false, + anchorRef: anchorRef, + className: classnames_default()('block-editor-block-list__block-popover', { + 'is-insertion-point-visible': isInsertionPointVisible + }), + __unstableStickyBoundaryElement: stickyBoundaryElement // Render in the old slot if needed for backward compatibility, + // otherwise render in place (not in the the default popover slot). + , + __unstableSlotName: __unstablePopoverSlot || null, + __unstableBoundaryParent: true // Observe movement for block animations (especially horizontal). + , + __unstableObserveElement: node, + shouldAnchorIncludePadding: true // Used to safeguard sticky position behavior against cases where it would permanently + // obscure specific sections of a block. + , + __unstableEditorCanvasWrapper: __unstableContentRef === null || __unstableContentRef === void 0 ? void 0 : __unstableContentRef.current + }, (shouldShowContextualToolbar || isToolbarForced) && (0,external_wp_element_namespaceObject.createElement)("div", { + onFocus: onFocus, + onBlur: onBlur // 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()('block-editor-block-list__block-popover-inserter', { + 'is-visible': isInserterShown + }) + }, (0,external_wp_element_namespaceObject.createElement)(inserter, { + clientId: clientId, + rootClientId: rootClientId, + __experimentalIsQuick: true + })), (shouldShowContextualToolbar || isToolbarForced) && (0,external_wp_element_namespaceObject.createElement)(block_contextual_toolbar // If the toolbar is being shown because of being forced + // it should focus the toolbar right after the mount. + , { + focusOnMount: isToolbarForced, + __experimentalInitialIndex: initialToolbarItemIndexRef.current, + __experimentalOnIndexChange: index => { + initialToolbarItemIndexRef.current = index; + } // Resets the index whenever the active block changes so + // this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169 + , + key: clientId + }), shouldShowBreadcrumb && (0,external_wp_element_namespaceObject.createElement)(block_selection_button, { + clientId: clientId, + rootClientId: rootClientId, + blockElement: node + }), showEmptyBlockSideInserter && (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-list__empty-block-inserter" + }, (0,external_wp_element_namespaceObject.createElement)(inserter, { + position: "bottom right", + rootClientId: rootClientId, + clientId: clientId, + __experimentalIsQuick: true + }))); +} + +function wrapperSelector(select) { + const { + getSelectedBlockClientId, + getFirstMultiSelectedBlockClientId, + getBlockRootClientId, + getBlock, + getBlockParents, + __experimentalGetBlockListSettingsForBlocks + } = select(store); + const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId(); + + if (!clientId) { + return; + } + + const { + name, + attributes = {}, + isValid + } = getBlock(clientId) || {}; + const blockParentsClientIds = getBlockParents(clientId); // Get Block List Settings for all ancestors of the current Block clientId. + + const parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(blockParentsClientIds); // Get the clientId of the topmost parent with the capture toolbars setting. + + + const capturingClientId = (0,external_lodash_namespaceObject.find)(blockParentsClientIds, parentClientId => { + var _parentBlockListSetti; + + return (_parentBlockListSetti = parentBlockListSettings[parentClientId]) === null || _parentBlockListSetti === void 0 ? void 0 : _parentBlockListSetti.__experimentalCaptureToolbars; + }); + return { + clientId, + rootClientId: getBlockRootClientId(clientId), + name, + isValid, + isEmptyDefaultBlock: name && (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)({ + name, + attributes + }), + capturingClientId + }; +} + +function WrappedBlockPopover(_ref2) { + let { + __unstablePopoverSlot, + __unstableContentRef + } = _ref2; + const selected = (0,external_wp_data_namespaceObject.useSelect)(wrapperSelector, []); + + if (!selected) { + return null; + } + + const { + clientId, + rootClientId, + name, + isValid, + isEmptyDefaultBlock, + capturingClientId + } = selected; + + if (!name) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)(BlockPopover, { + clientId: clientId, + rootClientId: rootClientId, + isValid: isValid, + isEmptyDefaultBlock: isEmptyDefaultBlock, + capturingClientId: capturingClientId, + __unstablePopoverSlot: __unstablePopoverSlot, + __unstableContentRef: __unstableContentRef + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/back-compat.js + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + +function BlockToolsBackCompat(_ref) { + let { + children + } = _ref; + const openRef = (0,external_wp_element_namespaceObject.useContext)(InsertionPointOpenRef); + const isDisabled = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.Disabled.Context); // If context is set, `BlockTools` is a parent component. + + if (openRef || isDisabled) { + return children; + } + + external_wp_deprecated_default()('wp.components.Popover.Slot name="block-toolbar"', { + alternative: 'wp.blockEditor.BlockTools', + since: '5.8' + }); + return (0,external_wp_element_namespaceObject.createElement)(InsertionPoint, { + __unstablePopoverSlot: "block-toolbar" + }, (0,external_wp_element_namespaceObject.createElement)(WrappedBlockPopover, { + __unstablePopoverSlot: "block-toolbar" + }), children); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/with-client-id.js + + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + +const withClientId = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => props => { + const { + clientId + } = useBlockEditContext(); + return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, _extends({}, props, { + clientId: clientId + })); +}, 'withClientId'); +/* harmony default export */ var with_client_id = (withClientId); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/button-block-appender.js + + +/** + * External dependencies + */ + +/** + * Internal dependencies + */ + + + +const button_block_appender_ButtonBlockAppender = _ref => { + let { + clientId, + showSeparator, + isFloating, + onAddBlock, + isToggle + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)(button_block_appender, { + className: classnames_default()({ + 'block-list-appender__toggle': isToggle + }), + rootClientId: clientId, + showSeparator: showSeparator, + isFloating: isFloating, + onAddBlock: onAddBlock + }); +}; +/* harmony default export */ var inner_blocks_button_block_appender = (with_client_id(button_block_appender_ButtonBlockAppender)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/default-block-appender.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + +const default_block_appender_DefaultBlockAppender = _ref => { + let { + clientId + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)(default_block_appender, { + rootClientId: clientId + }); +}; +/* harmony default export */ var inner_blocks_default_block_appender = ((0,external_wp_compose_namespaceObject.compose)([with_client_id, (0,external_wp_data_namespaceObject.withSelect)((select, _ref2) => { + let { + clientId + } = _ref2; + const { + getBlockOrder + } = select(store); + const blockClientIds = getBlockOrder(clientId); + return { + lastBlockClientId: (0,external_lodash_namespaceObject.last)(blockClientIds) + }; +})])(default_block_appender_DefaultBlockAppender)); + +;// CONCATENATED MODULE: external ["wp","isShallowEqual"] +var external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"]; +var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject); +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-nested-settings-update.js +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + +/** @typedef {import('../../selectors').WPDirectInsertBlock } WPDirectInsertBlock */ + +/** + * This hook is a side effect which updates the block-editor store when changes + * happen to inner block settings. The given props are transformed into a + * settings object, and if that is different from the current settings object in + * the block-editor store, then the store is updated with the new settings which + * came from props. + * + * @param {string} clientId The client ID of the block to update. + * @param {string[]} allowedBlocks An array of block names which are permitted + * in inner blocks. + * @param {?WPDirectInsertBlock} __experimentalDefaultBlock The default block to insert: [ blockName, { blockAttributes } ]. + * @param {?Function|boolean} __experimentalDirectInsert If a default block should be inserted directly by the + * appender. + * @param {string} [templateLock] The template lock specified for the inner + * blocks component. (e.g. "all") + * @param {boolean} captureToolbars Whether or children toolbars should be shown + * in the inner blocks component rather than on + * the child block. + * @param {string} orientation The direction in which the block + * should face. + * @param {Object} layout The layout object for the block container. + */ + +function useNestedSettingsUpdate(clientId, allowedBlocks, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, layout) { + const { + updateBlockListSettings + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const { + blockListSettings, + parentLock + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const rootClientId = select(store).getBlockRootClientId(clientId); + return { + blockListSettings: select(store).getBlockListSettings(clientId), + parentLock: select(store).getTemplateLock(rootClientId) + }; + }, [clientId]); // Memoize as inner blocks implementors often pass a new array on every + // render. + + const _allowedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => allowedBlocks, allowedBlocks); + + (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { + const newSettings = { + allowedBlocks: _allowedBlocks, + templateLock: templateLock === undefined ? parentLock : templateLock + }; // These values are not defined for RN, so only include them if they + // are defined. + + if (captureToolbars !== undefined) { + newSettings.__experimentalCaptureToolbars = captureToolbars; + } // Orientation depends on layout, + // ideally the separate orientation prop should be deprecated. + + + if (orientation !== undefined) { + newSettings.orientation = orientation; + } else { + const layoutType = getLayoutType(layout === null || layout === void 0 ? void 0 : layout.type); + newSettings.orientation = layoutType.getOrientation(layout); + } + + if (__experimentalDefaultBlock !== undefined) { + newSettings.__experimentalDefaultBlock = __experimentalDefaultBlock; + } + + if (__experimentalDirectInsert !== undefined) { + newSettings.__experimentalDirectInsert = __experimentalDirectInsert; + } + + if (!external_wp_isShallowEqual_default()(blockListSettings, newSettings)) { + updateBlockListSettings(clientId, newSettings); + } + }, [clientId, blockListSettings, _allowedBlocks, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, parentLock, captureToolbars, orientation, updateBlockListSettings, layout]); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-inner-block-template-sync.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + +/** + * This hook makes sure that a block's inner blocks stay in sync with the given + * block "template". The template is a block hierarchy to which inner blocks must + * conform. If the blocks get "out of sync" with the template and the template + * is meant to be locked (e.g. templateLock = "all"), then we replace the inner + * blocks with the correct value after synchronizing it with the template. + * + * @param {string} clientId The block client ID. + * @param {Object} template The template to match. + * @param {string} templateLock The template lock state for the inner blocks. For + * example, if the template lock is set to "all", + * then the inner blocks will stay in sync with the + * template. If not defined or set to false, then + * the inner blocks will not be synchronized with + * the given template. + * @param {boolean} templateInsertUpdatesSelection Whether or not to update the + * block-editor selection state when inner blocks + * are replaced after template synchronization. + */ + +function useInnerBlockTemplateSync(clientId, template, templateLock, templateInsertUpdatesSelection) { + const { + getSelectedBlocksInitialCaretPosition + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const { + replaceInnerBlocks + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const innerBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getBlocks(clientId), [clientId]); // Maintain a reference to the previous value so we can do a deep equality check. + + const existingTemplate = (0,external_wp_element_namespaceObject.useRef)(null); + (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { + // Only synchronize innerBlocks with template if innerBlocks are empty or + // a locking all exists directly on the block. + if (innerBlocks.length === 0 || templateLock === 'all') { + const hasTemplateChanged = !(0,external_lodash_namespaceObject.isEqual)(template, existingTemplate.current); + + if (hasTemplateChanged) { + existingTemplate.current = template; + const nextBlocks = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(innerBlocks, template); + + if (!(0,external_lodash_namespaceObject.isEqual)(nextBlocks, innerBlocks)) { + replaceInnerBlocks(clientId, nextBlocks, innerBlocks.length === 0 && templateInsertUpdatesSelection && nextBlocks.length !== 0, // This ensures the "initialPosition" doesn't change when applying the template + // If we're supposed to focus the block, we'll focus the first inner block + // otherwise, we won't apply any auto-focus. + // This ensures for instance that the focus stays in the inserter when inserting the "buttons" block. + getSelectedBlocksInitialCaretPosition()); + } + } + } + }, [innerBlocks, template, templateLock, clientId]); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/get-block-context.js +/** + * External dependencies + */ + +/** + * Block context cache, implemented as a WeakMap mapping block types to a + * WeakMap mapping attributes object to context value. + * + * @type {WeakMap>} + */ + +const BLOCK_CONTEXT_CACHE = new WeakMap(); +/** + * Returns a cached context object value for a given set of attributes for the + * block type. + * + * @param {Record} attributes Block attributes object. + * @param {WPBlockType} blockType Block type settings. + * + * @return {Record} Context value. + */ + +function getBlockContext(attributes, blockType) { + if (!BLOCK_CONTEXT_CACHE.has(blockType)) { + BLOCK_CONTEXT_CACHE.set(blockType, new WeakMap()); + } + + const blockTypeCache = BLOCK_CONTEXT_CACHE.get(blockType); + + if (!blockTypeCache.has(attributes)) { + const context = (0,external_lodash_namespaceObject.mapValues)(blockType.providesContext, attributeName => attributes[attributeName]); + blockTypeCache.set(attributes, context); + } + + return blockTypeCache.get(attributes); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-on-block-drop/index.js +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + +/** @typedef {import('@wordpress/element').WPSyntheticEvent} WPSyntheticEvent */ + +/** + * Retrieve the data for a block drop event. + * + * @param {WPSyntheticEvent} event The drop event. + * + * @return {Object} An object with block drag and drop data. + */ + +function parseDropEvent(event) { + let result = { + srcRootClientId: null, + srcClientIds: null, + srcIndex: null, + type: null, + blocks: null + }; + + if (!event.dataTransfer) { + return result; + } + + try { + result = Object.assign(result, JSON.parse(event.dataTransfer.getData('wp-blocks'))); + } catch (err) { + return result; + } + + return result; +} +/** + * A function that returns an event handler function for block drop events. + * + * @param {string} targetRootClientId The root client id where the block(s) will be inserted. + * @param {number} targetBlockIndex The index where the block(s) will be inserted. + * @param {Function} getBlockIndex A function that gets the index of a block. + * @param {Function} getClientIdsOfDescendants A function that gets the client ids of descendant blocks. + * @param {Function} moveBlocksToPosition A function that moves blocks. + * @param {Function} insertBlocks A function that inserts blocks. + * @param {Function} clearSelectedBlock A function that clears block selection. + * @return {Function} The event handler for a block drop event. + */ + +function onBlockDrop(targetRootClientId, targetBlockIndex, getBlockIndex, getClientIdsOfDescendants, moveBlocksToPosition, insertBlocks, clearSelectedBlock) { + return event => { + const { + srcRootClientId: sourceRootClientId, + srcClientIds: sourceClientIds, + type: dropType, + blocks + } = parseDropEvent(event); // If the user is inserting a block. + + if (dropType === 'inserter') { + clearSelectedBlock(); + const blocksToInsert = blocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block)); + insertBlocks(blocksToInsert, targetBlockIndex, targetRootClientId, true, null); + } // If the user is moving a block. + + + if (dropType === 'block') { + const sourceBlockIndex = getBlockIndex(sourceClientIds[0]); // If the user is dropping to the same position, return early. + + if (sourceRootClientId === targetRootClientId && sourceBlockIndex === targetBlockIndex) { + return; + } // If the user is attempting to drop a block within its own + // nested blocks, return early as this would create infinite + // recursion. + + + if (sourceClientIds.includes(targetRootClientId) || getClientIdsOfDescendants(sourceClientIds).some(id => id === targetRootClientId)) { + return; + } + + const isAtSameLevel = sourceRootClientId === targetRootClientId; + const draggedBlockCount = sourceClientIds.length; // If the block is kept at the same level and moved downwards, + // subtract to take into account that the blocks being dragged + // were removed from the block list above the insertion point. + + const insertIndex = isAtSameLevel && sourceBlockIndex < targetBlockIndex ? targetBlockIndex - draggedBlockCount : targetBlockIndex; + moveBlocksToPosition(sourceClientIds, sourceRootClientId, targetRootClientId, insertIndex); + } + }; +} +/** + * A function that returns an event handler function for block-related file drop events. + * + * @param {string} targetRootClientId The root client id where the block(s) will be inserted. + * @param {number} targetBlockIndex The index where the block(s) will be inserted. + * @param {boolean} hasUploadPermissions Whether the user has upload permissions. + * @param {Function} updateBlockAttributes A function that updates a block's attributes. + * @param {Function} canInsertBlockType A function that returns checks whether a block type can be inserted. + * @param {Function} insertBlocks A function that inserts blocks. + * + * @return {Function} The event handler for a block-related file drop event. + */ + +function onFilesDrop(targetRootClientId, targetBlockIndex, hasUploadPermissions, updateBlockAttributes, canInsertBlockType, insertBlocks) { + return files => { + if (!hasUploadPermissions) { + return; + } + + const transformation = (0,external_wp_blocks_namespaceObject.findTransform)((0,external_wp_blocks_namespaceObject.getBlockTransforms)('from'), transform => transform.type === 'files' && canInsertBlockType(transform.blockName, targetRootClientId) && transform.isMatch(files)); + + if (transformation) { + const blocks = transformation.transform(files, updateBlockAttributes); + insertBlocks(blocks, targetBlockIndex, targetRootClientId); + } + }; +} +/** + * A function that returns an event handler function for block-related HTML drop events. + * + * @param {string} targetRootClientId The root client id where the block(s) will be inserted. + * @param {number} targetBlockIndex The index where the block(s) will be inserted. + * @param {Function} insertBlocks A function that inserts blocks. + * + * @return {Function} The event handler for a block-related HTML drop event. + */ + +function onHTMLDrop(targetRootClientId, targetBlockIndex, insertBlocks) { + return HTML => { + const blocks = (0,external_wp_blocks_namespaceObject.pasteHandler)({ + HTML, + mode: 'BLOCKS' + }); + + if (blocks.length) { + insertBlocks(blocks, targetBlockIndex, targetRootClientId); + } + }; +} +/** + * A React hook for handling block drop events. + * + * @param {string} targetRootClientId The root client id where the block(s) will be inserted. + * @param {number} targetBlockIndex The index where the block(s) will be inserted. + * + * @return {Object} An object that contains the event handlers `onDrop`, `onFilesDrop` and `onHTMLDrop`. + */ + +function useOnBlockDrop(targetRootClientId, targetBlockIndex) { + const hasUploadPermissions = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().mediaUpload, []); + const { + canInsertBlockType, + getBlockIndex, + getClientIdsOfDescendants + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const { + insertBlocks, + moveBlocksToPosition, + updateBlockAttributes, + clearSelectedBlock + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + + const _onDrop = onBlockDrop(targetRootClientId, targetBlockIndex, getBlockIndex, getClientIdsOfDescendants, moveBlocksToPosition, insertBlocks, clearSelectedBlock); + + const _onFilesDrop = onFilesDrop(targetRootClientId, targetBlockIndex, hasUploadPermissions, updateBlockAttributes, canInsertBlockType, insertBlocks); + + const _onHTMLDrop = onHTMLDrop(targetRootClientId, targetBlockIndex, insertBlocks); + + return event => { + const files = (0,external_wp_dom_namespaceObject.getFilesFromDataTransfer)(event.dataTransfer); + const html = event.dataTransfer.getData('text/html'); + /** + * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML. + * The order of the checks is important to recognise the HTML drop. + */ + + if (html) { + _onHTMLDrop(html); + } else if (files.length) { + _onFilesDrop(files); + } else { + _onDrop(event); + } + }; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/math.js +/** + * A string representing the name of an edge. + * + * @typedef {'top'|'right'|'bottom'|'left'} WPEdgeName + */ + +/** + * @typedef {Object} WPPoint + * @property {number} x The horizontal position. + * @property {number} y The vertical position. + */ + +/** + * Given a point, a DOMRect and the name of an edge, returns the distance to + * that edge of the rect. + * + * This function works for edges that are horizontal or vertical (e.g. not + * rotated), the following terms are used so that the function works in both + * orientations: + * + * - Forward, meaning the axis running horizontally when an edge is vertical + * and vertically when an edge is horizontal. + * - Lateral, meaning the axis running vertically when an edge is vertical + * and horizontally when an edge is horizontal. + * + * @param {WPPoint} point The point to measure distance from. + * @param {DOMRect} rect A DOM Rect containing edge positions. + * @param {WPEdgeName} edge The edge to measure to. + */ +function getDistanceFromPointToEdge(point, rect, edge) { + const isHorizontal = edge === 'top' || edge === 'bottom'; + const { + x, + y + } = point; + const pointLateralPosition = isHorizontal ? x : y; + const pointForwardPosition = isHorizontal ? y : x; + const edgeStart = isHorizontal ? rect.left : rect.top; + const edgeEnd = isHorizontal ? rect.right : rect.bottom; + const edgeForwardPosition = rect[edge]; // Measure the straight line distance to the edge of the rect, when the + // point is adjacent to the edge. + // Else, if the point is positioned diagonally to the edge of the rect, + // measure diagonally to the nearest corner that the edge meets. + + let edgeLateralPosition; + + if (pointLateralPosition >= edgeStart && pointLateralPosition <= edgeEnd) { + edgeLateralPosition = pointLateralPosition; + } else if (pointLateralPosition < edgeEnd) { + edgeLateralPosition = edgeStart; + } else { + edgeLateralPosition = edgeEnd; + } + + return Math.sqrt((pointLateralPosition - edgeLateralPosition) ** 2 + (pointForwardPosition - edgeForwardPosition) ** 2); +} +/** + * Given a point, a DOMRect and a list of allowed edges returns the name of and + * distance to the nearest edge. + * + * @param {WPPoint} point The point to measure distance from. + * @param {DOMRect} rect A DOM Rect containing edge positions. + * @param {WPEdgeName[]} allowedEdges A list of the edges included in the + * calculation. Defaults to all edges. + * + * @return {[number, string]} An array where the first value is the distance + * and a second is the edge name. + */ + +function getDistanceToNearestEdge(point, rect) { + let allowedEdges = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['top', 'bottom', 'left', 'right']; + let candidateDistance; + let candidateEdge; + allowedEdges.forEach(edge => { + const distance = getDistanceFromPointToEdge(point, rect, edge); + + if (candidateDistance === undefined || distance < candidateDistance) { + candidateDistance = distance; + candidateEdge = edge; + } + }); + return [candidateDistance, candidateEdge]; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-block-drop-zone/index.js +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + +/** @typedef {import('../../utils/math').WPPoint} WPPoint */ + +/** + * The orientation of a block list. + * + * @typedef {'horizontal'|'vertical'|undefined} WPBlockListOrientation + */ + +/** + * Given a list of block DOM elements finds the index that a block should be dropped + * at. + * + * @param {Element[]} elements Array of DOM elements that represent each block in a block list. + * @param {WPPoint} position The position of the item being dragged. + * @param {WPBlockListOrientation} orientation The orientation of a block list. + * + * @return {number|undefined} The block index that's closest to the drag position. + */ + +function getNearestBlockIndex(elements, position, orientation) { + const allowedEdges = orientation === 'horizontal' ? ['left', 'right'] : ['top', 'bottom']; + const isRightToLeft = (0,external_wp_i18n_namespaceObject.isRTL)(); + let candidateIndex; + let candidateDistance; + elements.forEach((element, index) => { + const rect = element.getBoundingClientRect(); + const [distance, edge] = getDistanceToNearestEdge(position, rect, allowedEdges); + + if (candidateDistance === undefined || distance < candidateDistance) { + // If the user is dropping to the trailing edge of the block + // add 1 to the index to represent dragging after. + // Take RTL languages into account where the left edge is + // the trailing edge. + const isTrailingEdge = edge === 'bottom' || !isRightToLeft && edge === 'right' || isRightToLeft && edge === 'left'; + const offset = isTrailingEdge ? 1 : 0; // Update the currently known best candidate. + + candidateDistance = distance; + candidateIndex = index + offset; + } + }); + return candidateIndex; +} +/** + * @typedef {Object} WPBlockDropZoneConfig + * @property {string} rootClientId The root client id for the block list. + */ + +/** + * A React hook that can be used to make a block list handle drag and drop. + * + * @param {WPBlockDropZoneConfig} dropZoneConfig configuration data for the drop zone. + */ + +function useBlockDropZone() { + let { + // An undefined value represents a top-level block. Default to an empty + // string for this so that `targetRootClientId` can be easily compared to + // values returned by the `getRootBlockClientId` selector, which also uses + // an empty string to represent top-level blocks. + rootClientId: targetRootClientId = '' + } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + const [targetBlockIndex, setTargetBlockIndex] = (0,external_wp_element_namespaceObject.useState)(null); + const isLockedAll = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getTemplateLock + } = select(store); + return getTemplateLock(targetRootClientId) === 'all'; + }, [targetRootClientId]); + const { + getBlockListSettings + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const { + showInsertionPoint, + hideInsertionPoint + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const onBlockDrop = useOnBlockDrop(targetRootClientId, targetBlockIndex); + const throttled = (0,external_wp_compose_namespaceObject.useThrottle)((0,external_wp_element_namespaceObject.useCallback)((event, currentTarget) => { + var _getBlockListSettings; + + const blockElements = Array.from(currentTarget.children).filter( // Ensure the element is a block. It should have the `wp-block` class. + element => element.classList.contains('wp-block')); + const targetIndex = getNearestBlockIndex(blockElements, { + x: event.clientX, + y: event.clientY + }, (_getBlockListSettings = getBlockListSettings(targetRootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation); + setTargetBlockIndex(targetIndex === undefined ? 0 : targetIndex); + + if (targetIndex !== null) { + showInsertionPoint(targetRootClientId, targetIndex); + } + }, []), 200); + return (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({ + isDisabled: isLockedAll, + onDrop: onBlockDrop, + + onDragOver(event) { + // `currentTarget` is only available while the event is being + // handled, so get it now and pass it to the thottled function. + // https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget + throttled(event, event.currentTarget); + }, + + onDragLeave() { + throttled.cancel(); + hideInsertionPoint(); + setTargetBlockIndex(null); + }, + + onDragEnd() { + throttled.cancel(); + hideInsertionPoint(); + setTargetBlockIndex(null); + } + + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/index.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + + + + + + + + + + +/** + * InnerBlocks is a component which allows a single block to have multiple blocks + * as children. The UncontrolledInnerBlocks component is used whenever the inner + * blocks are not controlled by another entity. In other words, it is normally + * used for inner blocks in the post editor + * + * @param {Object} props The component props. + */ + +function UncontrolledInnerBlocks(props) { + const { + clientId, + allowedBlocks, + __experimentalDefaultBlock, + __experimentalDirectInsert, + template, + templateLock, + wrapperRef, + templateInsertUpdatesSelection, + __experimentalCaptureToolbars: captureToolbars, + __experimentalAppenderTagName, + renderAppender, + orientation, + placeholder, + __experimentalLayout + } = props; + useNestedSettingsUpdate(clientId, allowedBlocks, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, __experimentalLayout); + useInnerBlockTemplateSync(clientId, template, templateLock, templateInsertUpdatesSelection); + const context = (0,external_wp_data_namespaceObject.useSelect)(select => { + const block = select(store).getBlock(clientId); + const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name); + + if (!blockType || !blockType.providesContext) { + return; + } + + return getBlockContext(block.attributes, blockType); + }, [clientId]); // This component needs to always be synchronous as it's the one changing + // the async mode depending on the block selection. + + return (0,external_wp_element_namespaceObject.createElement)(BlockContextProvider, { + value: context + }, (0,external_wp_element_namespaceObject.createElement)(BlockListItems, { + rootClientId: clientId, + renderAppender: renderAppender, + __experimentalAppenderTagName: __experimentalAppenderTagName, + __experimentalLayout: __experimentalLayout, + wrapperRef: wrapperRef, + placeholder: placeholder + })); +} +/** + * The controlled inner blocks component wraps the uncontrolled inner blocks + * component with the blockSync hook. This keeps the innerBlocks of the block in + * the block-editor store in sync with the blocks of the controlling entity. An + * example of an inner block controller is a template part block, which provides + * its own blocks from the template part entity data source. + * + * @param {Object} props The component props. + */ + + +function ControlledInnerBlocks(props) { + useBlockSync(props); + return (0,external_wp_element_namespaceObject.createElement)(UncontrolledInnerBlocks, props); +} + +const ForwardedInnerBlocks = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { + const innerBlocksProps = useInnerBlocksProps({ + ref + }, props); + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-inner-blocks" + }, (0,external_wp_element_namespaceObject.createElement)("div", innerBlocksProps)); +}); +/** + * This hook is used to lightly mark an element as an inner blocks wrapper + * element. Call this hook and pass the returned props to the element to mark as + * an inner blocks wrapper, automatically rendering inner blocks as children. If + * you define a ref for the element, it is important to pass the ref to this + * hook, which the hook in turn will pass to the component through the props it + * returns. Optionally, you can also pass any other props through this hook, and + * they will be merged and returned. + * + * @param {Object} props Optional. Props to pass to the element. Must contain + * the ref if one is defined. + * @param {Object} options Optional. Inner blocks options. + * + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md + */ + +function useInnerBlocksProps() { + let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + const { + clientId + } = useBlockEditContext(); + const isSmallScreen = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); + const { + __experimentalCaptureToolbars, + hasOverlay + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + if (!clientId) { + return {}; + } + + const { + getBlockName, + isBlockSelected, + hasSelectedInnerBlock, + isNavigationMode + } = select(store); + const blockName = getBlockName(clientId); + const enableClickThrough = isNavigationMode() || isSmallScreen; + return { + __experimentalCaptureToolbars: select(external_wp_blocks_namespaceObject.store).hasBlockSupport(blockName, '__experimentalExposeControlsToChildren', false), + hasOverlay: blockName !== 'core/template' && !isBlockSelected(clientId) && !hasSelectedInnerBlock(clientId, true) && enableClickThrough + }; + }, [clientId, isSmallScreen]); + const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([props.ref, useBlockDropZone({ + rootClientId: clientId + })]); + const innerBlocksProps = { + __experimentalCaptureToolbars, + ...options + }; + const InnerBlocks = innerBlocksProps.value && innerBlocksProps.onChange ? ControlledInnerBlocks : UncontrolledInnerBlocks; + return { ...props, + ref, + className: classnames_default()(props.className, 'block-editor-block-list__layout', { + 'has-overlay': hasOverlay + }), + children: clientId ? (0,external_wp_element_namespaceObject.createElement)(InnerBlocks, _extends({}, innerBlocksProps, { + clientId: clientId + })) : (0,external_wp_element_namespaceObject.createElement)(BlockListItems, options) + }; +} +useInnerBlocksProps.save = external_wp_blocks_namespaceObject.__unstableGetInnerBlocksProps; // Expose default appender placeholders as components. + +ForwardedInnerBlocks.DefaultBlockAppender = inner_blocks_default_block_appender; +ForwardedInnerBlocks.ButtonBlockAppender = inner_blocks_button_block_appender; + +ForwardedInnerBlocks.Content = () => useInnerBlocksProps.save().children; +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md + */ + + +/* harmony default export */ var inner_blocks = (ForwardedInnerBlocks); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/index.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + + + + + + + + +const elementContext = (0,external_wp_element_namespaceObject.createContext)(); +const IntersectionObserver = (0,external_wp_element_namespaceObject.createContext)(); + +function Root(_ref) { + let { + className, + ...settings + } = _ref; + const [element, setElement] = (0,external_wp_element_namespaceObject.useState)(); + const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); + const { + isOutlineMode, + isFocusMode, + isNavigationMode + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getSettings, + isNavigationMode: _isNavigationMode + } = select(store); + const { + outlineMode, + focusMode + } = getSettings(); + return { + isOutlineMode: outlineMode, + isFocusMode: focusMode, + isNavigationMode: _isNavigationMode() + }; + }, []); + const innerBlocksProps = useInnerBlocksProps({ + ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([useBlockSelectionClearer(), useInBetweenInserter(), setElement]), + className: classnames_default()('is-root-container', className, { + 'is-outline-mode': isOutlineMode, + 'is-focus-mode': isFocusMode && isLargeViewport, + 'is-navigate-mode': isNavigationMode + }) + }, settings); + return (0,external_wp_element_namespaceObject.createElement)(elementContext.Provider, { + value: element + }, (0,external_wp_element_namespaceObject.createElement)("div", innerBlocksProps)); +} + +function BlockList(settings) { + usePreParsePatterns(); + return (0,external_wp_element_namespaceObject.createElement)(BlockToolsBackCompat, null, (0,external_wp_element_namespaceObject.createElement)(Provider, { + value: DEFAULT_BLOCK_EDIT_CONTEXT + }, (0,external_wp_element_namespaceObject.createElement)(Root, settings))); +} +BlockList.__unstableElementContext = elementContext; + +function Items(_ref2) { + let { + placeholder, + rootClientId, + renderAppender, + __experimentalAppenderTagName, + __experimentalLayout: layout = defaultLayout + } = _ref2; + const [intersectingBlocks, setIntersectingBlocks] = (0,external_wp_element_namespaceObject.useState)(new Set()); + const intersectionObserver = (0,external_wp_element_namespaceObject.useMemo)(() => { + const { + IntersectionObserver: Observer + } = window; + + if (!Observer) { + return; + } + + return new Observer(entries => { + setIntersectingBlocks(oldIntersectingBlocks => { + const newIntersectingBlocks = new Set(oldIntersectingBlocks); + + for (const entry of entries) { + const clientId = entry.target.getAttribute('data-block'); + const action = entry.isIntersecting ? 'add' : 'delete'; + newIntersectingBlocks[action](clientId); + } + + return newIntersectingBlocks; + }); + }); + }, [setIntersectingBlocks]); + const { + order, + selectedBlocks + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getBlockOrder, + getSelectedBlockClientIds + } = select(store); + return { + order: getBlockOrder(rootClientId), + selectedBlocks: getSelectedBlockClientIds() + }; + }, [rootClientId]); + return (0,external_wp_element_namespaceObject.createElement)(LayoutProvider, { + value: layout + }, (0,external_wp_element_namespaceObject.createElement)(IntersectionObserver.Provider, { + value: intersectionObserver + }, order.map(clientId => (0,external_wp_element_namespaceObject.createElement)(external_wp_data_namespaceObject.AsyncModeProvider, { + key: clientId, + value: // Only provide data asynchronously if the block is + // not visible and not selected. + !intersectingBlocks.has(clientId) && !selectedBlocks.includes(clientId) + }, (0,external_wp_element_namespaceObject.createElement)(block, { + rootClientId: rootClientId, + clientId: clientId + })))), order.length < 1 && placeholder, (0,external_wp_element_namespaceObject.createElement)(block_list_appender, { + tagName: __experimentalAppenderTagName, + rootClientId: rootClientId, + renderAppender: renderAppender + })); +} + +function BlockListItems(props) { + // This component needs to always be synchronous as it's the one changing + // the async mode depending on the block selection. + return (0,external_wp_element_namespaceObject.createElement)(external_wp_data_namespaceObject.AsyncModeProvider, { + value: false + }, (0,external_wp_element_namespaceObject.createElement)(Items, props)); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/control.js + + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + +const colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients']; + +function ColorGradientControlInner(_ref) { + let { + colors, + gradients, + disableCustomColors, + disableCustomGradients, + __experimentalHasMultipleOrigins, + __experimentalIsRenderedInSidebar, + className, + label, + onColorChange, + onGradientChange, + colorValue, + gradientValue, + clearable, + showTitle = true, + enableAlpha + } = _ref; + const canChooseAColor = onColorChange && (!(0,external_lodash_namespaceObject.isEmpty)(colors) || !disableCustomColors); + const canChooseAGradient = onGradientChange && (!(0,external_lodash_namespaceObject.isEmpty)(gradients) || !disableCustomGradients); + const [currentTab, setCurrentTab] = (0,external_wp_element_namespaceObject.useState)(gradientValue ? 'gradient' : !!canChooseAColor && 'color'); + + if (!canChooseAColor && !canChooseAGradient) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, { + className: classnames_default()('block-editor-color-gradient-control', className) + }, (0,external_wp_element_namespaceObject.createElement)("fieldset", { + className: "block-editor-color-gradient-control__fieldset" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { + spacing: 1 + }, showTitle && (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-color-gradient-control__color-indicator" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, null, label))), canChooseAColor && canChooseAGradient && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { + value: currentTab, + onChange: setCurrentTab, + label: (0,external_wp_i18n_namespaceObject.__)('Select color type'), + hideLabelFromVision: true, + isBlock: true + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { + value: "color", + label: (0,external_wp_i18n_namespaceObject.__)('Solid') + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { + value: "gradient", + label: (0,external_wp_i18n_namespaceObject.__)('Gradient') + })), (currentTab === 'color' || !canChooseAGradient) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorPalette, { + value: colorValue, + onChange: canChooseAGradient ? newColor => { + onColorChange(newColor); + onGradientChange(); + } : onColorChange, + colors, + disableCustomColors, + __experimentalHasMultipleOrigins: __experimentalHasMultipleOrigins, + __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar, + clearable: clearable, + enableAlpha: enableAlpha + }), (currentTab === 'gradient' || !canChooseAColor) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.GradientPicker, { + value: gradientValue, + onChange: canChooseAColor ? newGradient => { + onGradientChange(newGradient); + onColorChange(); + } : onGradientChange, + gradients, + disableCustomGradients, + __experimentalHasMultipleOrigins: __experimentalHasMultipleOrigins, + __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar, + clearable: clearable + })))); +} + +function ColorGradientControlSelect(props) { + const colorGradientSettings = {}; + colorGradientSettings.colors = useSetting('color.palette'); + colorGradientSettings.gradients = useSetting('color.gradients'); + colorGradientSettings.disableCustomColors = !useSetting('color.custom'); + colorGradientSettings.disableCustomGradients = !useSetting('color.customGradient'); + return (0,external_wp_element_namespaceObject.createElement)(ColorGradientControlInner, _extends({}, colorGradientSettings, props)); +} + +function ColorGradientControl(props) { + if ((0,external_lodash_namespaceObject.every)(colorsAndGradientKeys, key => props.hasOwnProperty(key))) { + return (0,external_wp_element_namespaceObject.createElement)(ColorGradientControlInner, props); + } + + return (0,external_wp_element_namespaceObject.createElement)(ColorGradientControlSelect, props); +} + +/* harmony default export */ var control = (ColorGradientControl); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/dropdown.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +function ColorGradientSettingsDropdown(_ref) { + let { + colors, + gradients, + disableCustomColors, + disableCustomGradients, + __experimentalHasMultipleOrigins, + __experimentalIsRenderedInSidebar, + enableAlpha, + settings + } = _ref; + let dropdownPosition; + + if (__experimentalIsRenderedInSidebar) { + dropdownPosition = 'bottom left'; + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, { + isBordered: true, + isSeparated: true, + className: "block-editor-panel-color-gradient-settings__item-group" + }, settings.map((setting, index) => setting && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { + key: index, + position: dropdownPosition, + className: "block-editor-panel-color-gradient-settings__dropdown", + contentClassName: "block-editor-panel-color-gradient-settings__dropdown-content", + renderToggle: _ref2 => { + var _setting$gradientValu; + + let { + isOpen, + onToggle + } = _ref2; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItem, { + onClick: onToggle, + className: classnames_default()('block-editor-panel-color-gradient-settings__item', { + 'is-open': isOpen + }) + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { + justify: "flex-start" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, { + className: "block-editor-panel-color-gradient-settings__color-indicator", + colorValue: (_setting$gradientValu = setting.gradientValue) !== null && _setting$gradientValu !== void 0 ? _setting$gradientValu : setting.colorValue + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, setting.label))); + }, + renderContent: () => (0,external_wp_element_namespaceObject.createElement)(control, _extends({ + showTitle: false, + colors, + gradients, + disableCustomColors, + disableCustomGradients, + __experimentalHasMultipleOrigins, + __experimentalIsRenderedInSidebar, + enableAlpha + }, setting)) + }))); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/use-common-single-multiple-selects.js +/** + * Internal dependencies + */ + +function useCommonSingleMultipleSelects() { + return { + disableCustomColors: !useSetting('color.custom'), + disableCustomGradients: !useSetting('color.customGradient') + }; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + +/** + * Retrieves color and gradient related settings. + * + * The arrays for colors and gradients are made up of color palettes from each + * origin i.e. "Core", "Theme", and "User". + * + * @return {Object} Color and gradient related settings. + */ + +function useMultipleOriginColorsAndGradients() { + const colorGradientSettings = useCommonSingleMultipleSelects(); + const customColors = useSetting('color.palette.custom'); + const themeColors = useSetting('color.palette.theme'); + const defaultColors = useSetting('color.palette.default'); + const shouldDisplayDefaultColors = useSetting('color.defaultPalette'); + colorGradientSettings.colors = (0,external_wp_element_namespaceObject.useMemo)(() => { + const result = []; + + if (themeColors && themeColors.length) { + result.push({ + name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'), + colors: themeColors + }); + } + + if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) { + result.push({ + name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'), + colors: defaultColors + }); + } + + if (customColors && customColors.length) { + result.push({ + name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette comes from the theme.'), + colors: customColors + }); + } + + return result; + }, [defaultColors, themeColors, customColors]); + const customGradients = useSetting('color.gradients.custom'); + const themeGradients = useSetting('color.gradients.theme'); + const defaultGradients = useSetting('color.gradients.default'); + const shouldDisplayDefaultGradients = useSetting('color.defaultGradients'); + colorGradientSettings.gradients = (0,external_wp_element_namespaceObject.useMemo)(() => { + const result = []; + + if (themeGradients && themeGradients.length) { + result.push({ + name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'), + gradients: themeGradients + }); + } + + if (shouldDisplayDefaultGradients && defaultGradients && defaultGradients.length) { + result.push({ + name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'), + gradients: defaultGradients + }); + } + + if (customGradients && customGradients.length) { + result.push({ + name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette is created by the user.'), + gradients: customGradients + }); + } + + return result; + }, [customGradients, themeGradients, defaultGradients]); + return colorGradientSettings; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/utils.js +/** + * External dependencies + */ + + + + +k([names, a11y]); +/** + * 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 {?Object} 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. + */ + +const getColorObjectByAttributeValues = (colors, definedColor, customColor) => { + if (definedColor) { + const colorObj = (0,external_lodash_namespaceObject.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 {?Object} Color object included in the colors array whose color property equals colorValue. + * Returns undefined if no color object matches this requirement. + */ + +const getColorObjectByColorValue = (colors, colorValue) => { + return (0,external_lodash_namespaceObject.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. + * Returns undefined if either colorContextName or colorSlug are not provided. + */ + +function getColorClassName(colorContextName, colorSlug) { + if (!colorContextName || !colorSlug) { + return undefined; + } + + return `has-${(0,external_lodash_namespaceObject.kebabCase)(colorSlug)}-${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 getMostReadableColor(colors, colorValue) { + const colordColor = w(colorValue); + return (0,external_lodash_namespaceObject.maxBy)(colors, _ref => { + let { + color + } = _ref; + return colordColor.contrast(color); + }).color; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/border-color.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + + + + + // Defining empty array here instead of inline avoids unnecessary re-renders of +// color control. + +const border_color_EMPTY_ARRAY = []; +/** + * Inspector control panel containing the border color related configuration. + * + * There is deliberate overlap between the colors and borders block supports + * relating to border color. It can be argued the border color controls could + * be included within either, or both, the colors and borders panels in the + * inspector controls. If they share the same block attributes it should not + * matter. + * + * @param {Object} props Block properties. + * + * @return {WPElement} Border color edit element. + */ + +function BorderColorEdit(props) { + const { + attributes: { + borderColor, + style + }, + setAttributes + } = props; + const colorGradientSettings = useMultipleOriginColorsAndGradients(); + const availableColors = colorGradientSettings.colors.reduce((colors, origin) => colors.concat(origin.colors), []); + const { + color: customBorderColor + } = (style === null || style === void 0 ? void 0 : style.border) || {}; + const [colorValue, setColorValue] = (0,external_wp_element_namespaceObject.useState)(() => { + var _getColorObjectByAttr; + + return (_getColorObjectByAttr = getColorObjectByAttributeValues(availableColors, borderColor, customBorderColor)) === null || _getColorObjectByAttr === void 0 ? void 0 : _getColorObjectByAttr.color; + }); // Detect changes in the color attributes and update the colorValue to keep the + // UI in sync. This is necessary for situations when border controls interact with + // each other: eg, setting the border width to zero causes the color and style + // selections to be cleared. + + (0,external_wp_element_namespaceObject.useEffect)(() => { + var _getColorObjectByAttr2; + + setColorValue((_getColorObjectByAttr2 = getColorObjectByAttributeValues(availableColors, borderColor, customBorderColor)) === null || _getColorObjectByAttr2 === void 0 ? void 0 : _getColorObjectByAttr2.color); + }, [borderColor, customBorderColor, availableColors]); + + const onChangeColor = value => { + setColorValue(value); + const colorObject = getColorObjectByColorValue(availableColors, value); + const newStyle = { ...style, + border: { ...(style === null || style === void 0 ? void 0 : style.border), + color: colorObject !== null && colorObject !== void 0 && colorObject.slug ? undefined : value + } + }; // If empty slug, ensure undefined to remove attribute. + + const newNamedColor = colorObject !== null && colorObject !== void 0 && colorObject.slug ? colorObject.slug : undefined; + setAttributes({ + style: cleanEmptyObject(newStyle), + borderColor: newNamedColor + }); + }; + + const settings = [{ + label: (0,external_wp_i18n_namespaceObject.__)('Color'), + onColorChange: onChangeColor, + colorValue, + clearable: false + }]; + return (0,external_wp_element_namespaceObject.createElement)(ColorGradientSettingsDropdown, _extends({ + settings: settings, + disableCustomColors: true, + disableCustomGradients: true, + __experimentalHasMultipleOrigins: true, + __experimentalIsRenderedInSidebar: true, + enableAlpha: true + }, colorGradientSettings)); +} +/** + * Checks if there is a current value in the border color block support + * attributes. + * + * @param {Object} props Block props. + * @return {boolean} Whether or not the block has a border color value set. + */ + +function hasBorderColorValue(props) { + var _style$border; + + const { + attributes: { + borderColor, + style + } + } = props; + return !!borderColor || !!(style !== null && style !== void 0 && (_style$border = style.border) !== null && _style$border !== void 0 && _style$border.color); +} +/** + * Resets the border color block support attributes. This can be used when + * disabling the border color support controls for a block via a progressive + * discovery panel. + * + * @param {Object} props Block props. + * @param {Object} props.attributes Block's attributes. + * @param {Object} props.setAttributes Function to set block's attributes. + */ + +function resetBorderColor(_ref) { + let { + attributes = {}, + setAttributes + } = _ref; + const { + style + } = attributes; + setAttributes({ + borderColor: undefined, + style: removeBorderAttribute(style, 'color') + }); +} +/** + * Filters registered block settings, extending attributes to include + * `borderColor` if needed. + * + * @param {Object} settings Original block settings. + * + * @return {Object} Updated block settings. + */ + +function addAttributes(settings) { + if (!hasBorderSupport(settings, 'color')) { + return settings; + } // Allow blocks to specify default value if needed. + + + if (settings.attributes.borderColor) { + return settings; + } // Add new borderColor attribute to block settings. + + + return { ...settings, + attributes: { ...settings.attributes, + borderColor: { + type: 'string' + } + } + }; +} +/** + * Override props assigned to save component to inject border color. + * + * @param {Object} props Additional props applied to save element. + * @param {Object} blockType Block type definition. + * @param {Object} attributes Block's attributes. + * + * @return {Object} Filtered props to apply to save element. + */ + + +function border_color_addSaveProps(props, blockType, attributes) { + var _style$border2; + + if (!hasBorderSupport(blockType, 'color') || shouldSkipSerialization(blockType, BORDER_SUPPORT_KEY, 'color')) { + return props; + } + + const { + borderColor, + style + } = attributes; + const borderColorClass = getColorClassName('border-color', borderColor); + const newClassName = classnames_default()(props.className, { + 'has-border-color': borderColor || (style === null || style === void 0 ? void 0 : (_style$border2 = style.border) === null || _style$border2 === void 0 ? void 0 : _style$border2.color), + [borderColorClass]: !!borderColorClass + }); // If we are clearing the last of the previous classes in `className` + // set it to `undefined` to avoid rendering empty DOM attributes. + + props.className = newClassName ? newClassName : undefined; + return props; +} +/** + * Filters the registered block settings to apply border color styles and + * classnames to the block edit wrapper. + * + * @param {Object} settings Original block settings. + * + * @return {Object} Filtered block settings. + */ + + +function addEditProps(settings) { + if (!hasBorderSupport(settings, 'color') || shouldSkipSerialization(settings, BORDER_SUPPORT_KEY, 'color')) { + return settings; + } + + const existingGetEditWrapperProps = settings.getEditWrapperProps; + + settings.getEditWrapperProps = attributes => { + let props = {}; + + if (existingGetEditWrapperProps) { + props = existingGetEditWrapperProps(attributes); + } + + return border_color_addSaveProps(props, settings, attributes); + }; + + return settings; +} +/** + * This adds inline styles for color palette colors. + * Ideally, this is not needed and themes should load their palettes on the editor. + * + * @param {Function} BlockListBlock Original component. + * + * @return {Function} Wrapped component. + */ + + +const withBorderColorPaletteStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockListBlock => props => { + var _getColorObjectByAttr3, _props$wrapperProps; + + const { + name, + attributes + } = props; + const { + borderColor + } = attributes; + const colors = useSetting('color.palette') || border_color_EMPTY_ARRAY; + + if (!hasBorderSupport(name, 'color') || shouldSkipSerialization(name, BORDER_SUPPORT_KEY, 'color')) { + return (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, props); + } + + const extraStyles = { + borderColor: borderColor ? (_getColorObjectByAttr3 = getColorObjectByAttributeValues(colors, borderColor)) === null || _getColorObjectByAttr3 === void 0 ? void 0 : _getColorObjectByAttr3.color : undefined + }; + let wrapperProps = props.wrapperProps; + wrapperProps = { ...props.wrapperProps, + style: { ...extraStyles, + ...((_props$wrapperProps = props.wrapperProps) === null || _props$wrapperProps === void 0 ? void 0 : _props$wrapperProps.style) + } + }; + return (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, _extends({}, props, { + wrapperProps: wrapperProps + })); +}); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/border/addAttributes', addAttributes); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/border/addSaveProps', border_color_addSaveProps); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/border/addEditProps', addEditProps); +(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/border/with-border-color-palette-styles', withBorderColorPaletteStyles); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/utils.js +/** + * WordPress dependencies + */ + +/** + * Gets the (non-undefined) item with the highest occurrence within an array + * Based in part on: https://stackoverflow.com/a/20762713 + * + * Undefined values are always sorted to the end by `sort`, so this function + * returns the first element, to always prioritize real values over undefined + * values. + * + * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description + * + * @param {Array} inputArray Array of items to check. + * @return {any} The item with the most occurrences. + */ + +function mode(inputArray) { + const arr = [...inputArray]; + return arr.sort((a, b) => inputArray.filter(v => v === b).length - inputArray.filter(v => v === a).length).shift(); +} +/** + * Returns the most common CSS unit in the radius values. + * Falls back to `px` as a default unit. + * + * @param {Object|string} values Radius values. + * @return {string} Most common CSS unit in values. Default: `px`. + */ + +function getAllUnit() { + let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + if (typeof values === 'string') { + const [, unit] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values); + return unit || 'px'; + } + + const allUnits = Object.values(values).map(value => { + const [, unit] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value); + return unit; + }); + return mode(allUnits) || 'px'; +} +/** + * Gets the 'all' input value and unit from values data. + * + * @param {Object|string} values Radius values. + * @return {string} A value + unit for the 'all' input. + */ + +function getAllValue() { + let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + /** + * Border radius support was originally a single pixel value. + * + * To maintain backwards compatibility treat this case as the all value. + */ + if (typeof values === 'string') { + return values; + } + + const parsedQuantitiesAndUnits = Object.values(values).map(value => (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value)); + const allValues = parsedQuantitiesAndUnits.map(value => { + var _value$; + + return (_value$ = value[0]) !== null && _value$ !== void 0 ? _value$ : ''; + }); + const allUnits = parsedQuantitiesAndUnits.map(value => value[1]); + const value = allValues.every(v => v === allValues[0]) ? allValues[0] : ''; + const unit = mode(allUnits); + const allValue = value === 0 || value ? `${value}${unit}` : undefined; + return allValue; +} +/** + * Checks to determine if values are mixed. + * + * @param {Object} values Radius values. + * @return {boolean} Whether values are mixed. + */ + +function hasMixedValues() { + let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + const allValue = getAllValue(values); + const isMixed = typeof values === 'string' ? false : isNaN(parseFloat(allValue)); + return isMixed; +} +/** + * Checks to determine if values are defined. + * + * @param {Object} values Radius values. + * @return {boolean} Whether values are mixed. + */ + +function hasDefinedValues(values) { + if (!values) { + return false; + } // A string value represents a shorthand value. + + + if (typeof values === 'string') { + return true; + } // An object represents longhand border radius values, if any are set + // flag values as being defined. + + + const filteredValues = Object.values(values).filter(value => { + return !!value || value === 0; + }); + return !!filteredValues.length; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/all-input-control.js + + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +function AllInputControl(_ref) { + let { + onChange, + values, + ...props + } = _ref; + const allValue = getAllValue(values); + const hasValues = hasDefinedValues(values); + const isMixed = hasValues && hasMixedValues(values); + const allPlaceholder = isMixed ? (0,external_wp_i18n_namespaceObject.__)('Mixed') : null; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, _extends({}, props, { + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Border radius'), + disableUnits: isMixed, + isOnly: true, + value: allValue, + onChange: onChange, + placeholder: allPlaceholder + })); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/input-controls.js + + + +/** + * WordPress dependencies + */ + + +const CORNERS = { + topLeft: (0,external_wp_i18n_namespaceObject.__)('Top left'), + topRight: (0,external_wp_i18n_namespaceObject.__)('Top right'), + bottomLeft: (0,external_wp_i18n_namespaceObject.__)('Bottom left'), + bottomRight: (0,external_wp_i18n_namespaceObject.__)('Bottom right') +}; +function BoxInputControls(_ref) { + let { + onChange, + values: valuesProp, + ...props + } = _ref; + + const createHandleOnChange = corner => next => { + if (!onChange) { + return; + } + + onChange({ ...values, + [corner]: next ? next : undefined + }); + }; // For shorthand style & backwards compatibility, handle flat string value. + + + const values = typeof valuesProp !== 'string' ? valuesProp : { + topLeft: valuesProp, + topRight: valuesProp, + bottomLeft: valuesProp, + bottomRight: valuesProp + }; // Controls are wrapped in tooltips as visible labels aren't desired here. + + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "components-border-radius-control__input-controls-wrapper" + }, Object.entries(CORNERS).map(_ref2 => { + let [key, label] = _ref2; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, _extends({}, props, { + key: key, + "aria-label": label, + value: values[key], + onChange: createHandleOnChange(key) + })); + })); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/link.js + + +/** + * WordPress dependencies + */ + +const link_link = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M15.6 7.2H14v1.5h1.6c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.8 0 5.2-2.3 5.2-5.2 0-2.9-2.3-5.2-5.2-5.2zM4.7 12.4c0-2 1.7-3.7 3.7-3.7H10V7.2H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H10v-1.5H8.4c-2 0-3.7-1.7-3.7-3.7zm4.6.9h5.3v-1.5H9.3v1.5z" +})); +/* harmony default export */ var library_link = (link_link); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/link-off.js + + +/** + * WordPress dependencies + */ + +const linkOff = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M15.6 7.3h-.7l1.6-3.5-.9-.4-3.9 8.5H9v1.5h2l-1.3 2.8H8.4c-2 0-3.7-1.7-3.7-3.7s1.7-3.7 3.7-3.7H10V7.3H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H9l-1.4 3.2.9.4 5.7-12.5h1.4c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.9 0 5.2-2.3 5.2-5.2 0-2.9-2.4-5.2-5.2-5.2z" +})); +/* harmony default export */ var link_off = (linkOff); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/linked-button.js + + + +/** + * WordPress dependencies + */ + + + +function LinkedButton(_ref) { + let { + isLinked, + ...props + } = _ref; + const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)('Unlink Radii') : (0,external_wp_i18n_namespaceObject.__)('Link Radii'); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Tooltip, { + text: label + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({}, props, { + className: "component-border-radius-control__linked-button", + isPrimary: isLinked, + isSecondary: !isLinked, + isSmall: true, + icon: isLinked ? library_link : link_off, + iconSize: 16, + "aria-label": label + }))); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/index.js + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + + + +const DEFAULT_VALUES = { + topLeft: null, + topRight: null, + bottomLeft: null, + bottomRight: null +}; +const MIN_BORDER_RADIUS_VALUE = 0; +const MAX_BORDER_RADIUS_VALUES = { + px: 100, + em: 20, + rem: 20 +}; +/** + * Control to display border radius options. + * + * @param {Object} props Component props. + * @param {Function} props.onChange Callback to handle onChange. + * @param {Object} props.values Border radius values. + * + * @return {WPElement} Custom border radius control. + */ + +function BorderRadiusControl(_ref) { + let { + onChange, + values + } = _ref; + const [isLinked, setIsLinked] = (0,external_wp_element_namespaceObject.useState)(!hasDefinedValues(values) || !hasMixedValues(values)); + const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ + availableUnits: useSetting('spacing.units') || ['px', 'em', 'rem'] + }); + const unit = getAllUnit(values); + const unitConfig = units && units.find(item => item.value === unit); + const step = (unitConfig === null || unitConfig === void 0 ? void 0 : unitConfig.step) || 1; + const [allValue] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(getAllValue(values)); + + const toggleLinked = () => setIsLinked(!isLinked); + + const handleSliderChange = next => { + onChange(next !== undefined ? `${next}${unit}` : undefined); + }; + + return (0,external_wp_element_namespaceObject.createElement)("fieldset", { + className: "components-border-radius-control" + }, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_i18n_namespaceObject.__)('Radius')), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "components-border-radius-control__wrapper" + }, isLinked ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(AllInputControl, { + className: "components-border-radius-control__unit-control", + values: values, + min: MIN_BORDER_RADIUS_VALUE, + onChange: onChange, + units: units + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, { + className: "components-border-radius-control__range-control", + value: allValue !== null && allValue !== void 0 ? allValue : '', + min: MIN_BORDER_RADIUS_VALUE, + max: MAX_BORDER_RADIUS_VALUES[unit], + initialPosition: 0, + withInputField: false, + onChange: handleSliderChange, + step: step + })) : (0,external_wp_element_namespaceObject.createElement)(BoxInputControls, { + min: MIN_BORDER_RADIUS_VALUE, + onChange: onChange, + values: values || DEFAULT_VALUES, + units: units + }), (0,external_wp_element_namespaceObject.createElement)(LinkedButton, { + onClick: toggleLinked, + isLinked: isLinked + }))); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/border-radius.js + + +/** + * Internal dependencies + */ + + + +/** + * Inspector control panel containing the border radius related configuration. + * + * @param {Object} props Block properties. + * + * @return {WPElement} Border radius edit element. + */ + +function BorderRadiusEdit(props) { + var _style$border; + + const { + attributes: { + style + }, + setAttributes + } = props; + + const onChange = newRadius => { + let newStyle = { ...style, + border: { ...(style === null || style === void 0 ? void 0 : style.border), + radius: newRadius + } + }; + + if (newRadius === undefined || newRadius === '') { + newStyle = cleanEmptyObject(newStyle); + } + + setAttributes({ + style: newStyle + }); + }; + + return (0,external_wp_element_namespaceObject.createElement)(BorderRadiusControl, { + values: style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.radius, + onChange: onChange + }); +} +/** + * Checks if there is a current value in the border radius block support + * attributes. + * + * @param {Object} props Block props. + * @return {boolean} Whether or not the block has a border radius value set. + */ + +function hasBorderRadiusValue(props) { + var _props$attributes$sty, _props$attributes$sty2; + + const borderRadius = (_props$attributes$sty = props.attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : (_props$attributes$sty2 = _props$attributes$sty.border) === null || _props$attributes$sty2 === void 0 ? void 0 : _props$attributes$sty2.radius; + + if (typeof borderRadius === 'object') { + return Object.entries(borderRadius).some(Boolean); + } + + return !!borderRadius; +} +/** + * Resets the border radius block support attributes. This can be used when + * disabling the border radius support controls for a block via a progressive + * discovery panel. + * + * @param {Object} props Block props. + * @param {Object} props.attributes Block's attributes. + * @param {Object} props.setAttributes Function to set block's attributes. + */ + +function resetBorderRadius(_ref) { + let { + attributes = {}, + setAttributes + } = _ref; + const { + style + } = attributes; + setAttributes({ + style: removeBorderAttribute(style, 'radius') + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/line-solid.js + + +/** + * WordPress dependencies + */ + +const lineSolid = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + width: "24", + height: "24", + fill: "none" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M5 11.25h14v1.5H5z" +})); +/* harmony default export */ var line_solid = (lineSolid); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/line-dashed.js + + +/** + * WordPress dependencies + */ + +const lineDashed = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + width: "24", + height: "24", + fill: "none" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + fillRule: "evenodd", + d: "M5 11.25h3v1.5H5v-1.5zm5.5 0h3v1.5h-3v-1.5zm8.5 0h-3v1.5h3v-1.5z", + clipRule: "evenodd" +})); +/* harmony default export */ var line_dashed = (lineDashed); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/line-dotted.js + + +/** + * WordPress dependencies + */ + +const lineDotted = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + width: "24", + height: "24", + fill: "none" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + fillRule: "evenodd", + d: "M5.25 11.25h1.5v1.5h-1.5v-1.5zm3 0h1.5v1.5h-1.5v-1.5zm4.5 0h-1.5v1.5h1.5v-1.5zm1.5 0h1.5v1.5h-1.5v-1.5zm4.5 0h-1.5v1.5h1.5v-1.5z", + clipRule: "evenodd" +})); +/* harmony default export */ var line_dotted = (lineDotted); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/border-style-control/index.js + + +/** + * WordPress dependencies + */ + + + +const BORDER_STYLES = [{ + label: (0,external_wp_i18n_namespaceObject.__)('Solid'), + icon: line_solid, + value: 'solid' +}, { + label: (0,external_wp_i18n_namespaceObject.__)('Dashed'), + icon: line_dashed, + value: 'dashed' +}, { + label: (0,external_wp_i18n_namespaceObject.__)('Dotted'), + icon: line_dotted, + value: 'dotted' +}]; +/** + * Control to display border style options. + * + * @param {Object} props Component props. + * @param {Function} props.onChange Handler for changing border style selection. + * @param {string} props.value Currently selected border style value. + * + * @return {WPElement} Custom border style segmented control. + */ + +function BorderStyleControl(_ref) { + let { + onChange, + value + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)("fieldset", { + className: "components-border-style-control" + }, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_i18n_namespaceObject.__)('Style')), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "components-border-style-control__buttons" + }, BORDER_STYLES.map(borderStyle => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + key: borderStyle.value, + icon: borderStyle.icon, + isSmall: true, + isPressed: borderStyle.value === value, + onClick: () => onChange(borderStyle.value === value ? undefined : borderStyle.value), + "aria-label": borderStyle.label + })))); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/border-style.js + + +/** + * Internal dependencies + */ + + + +/** + * Inspector control for configuring border style property. + * + * @param {Object} props Block properties. + * + * @return {WPElement} Border style edit element. + */ + +const BorderStyleEdit = props => { + var _style$border; + + const { + attributes: { + style + }, + setAttributes + } = props; + + const onChange = newBorderStyle => { + const newStyleAttributes = { ...style, + border: { ...(style === null || style === void 0 ? void 0 : style.border), + style: newBorderStyle + } + }; + setAttributes({ + style: cleanEmptyObject(newStyleAttributes) + }); + }; + + return (0,external_wp_element_namespaceObject.createElement)(BorderStyleControl, { + value: style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.style, + onChange: onChange + }); +}; +/** + * Checks if there is a current value in the border style block support + * attributes. + * + * @param {Object} props Block props. + * @return {boolean} Whether or not the block has a border style value set. + */ + +function hasBorderStyleValue(props) { + var _props$attributes$sty, _props$attributes$sty2; + + return !!((_props$attributes$sty = props.attributes.style) !== null && _props$attributes$sty !== void 0 && (_props$attributes$sty2 = _props$attributes$sty.border) !== null && _props$attributes$sty2 !== void 0 && _props$attributes$sty2.style); +} +/** + * Resets the border style block support attribute. This can be used when + * disabling the border style support control for a block via a progressive + * discovery panel. + * + * @param {Object} props Block props. + * @param {Object} props.attributes Block's attributes. + * @param {Object} props.setAttributes Function to set block's attributes. + */ + +function resetBorderStyle(_ref) { + let { + attributes = {}, + setAttributes + } = _ref; + const { + style + } = attributes; + setAttributes({ + style: removeBorderAttribute(style, 'style') + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/border-width.js + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + +const MIN_BORDER_WIDTH = 0; +/** + * Inspector control for configuring border width property. + * + * @param {Object} props Block properties. + * + * @return {WPElement} Border width edit element. + */ + +const BorderWidthEdit = props => { + const { + attributes: { + borderColor, + style + }, + setAttributes + } = props; + const { + width, + color: customBorderColor, + style: borderStyle + } = (style === null || style === void 0 ? void 0 : style.border) || {}; // Used to temporarily track previous border color & style selections to be + // able to restore them when border width changes from zero value. + + const [styleSelection, setStyleSelection] = (0,external_wp_element_namespaceObject.useState)(); + const [colorSelection, setColorSelection] = (0,external_wp_element_namespaceObject.useState)(); + const [customColorSelection, setCustomColorSelection] = (0,external_wp_element_namespaceObject.useState)(); + + const onChange = newWidth => { + let newStyle = { ...style, + border: { ...(style === null || style === void 0 ? void 0 : style.border), + width: newWidth + } + }; // Used to clear named border color attribute. + + let borderPaletteColor = borderColor; + const hasZeroWidth = parseFloat(newWidth) === 0; + const hadPreviousZeroWidth = parseFloat(width) === 0; // Setting the border width explicitly to zero will also set the + // border style to `none` and clear border color attributes. + + if (hasZeroWidth && !hadPreviousZeroWidth) { + // Before clearing color and style selections, keep track of + // the current selections so they can be restored when the width + // changes to a non-zero value. + setColorSelection(borderColor); + setCustomColorSelection(customBorderColor); + setStyleSelection(borderStyle); // Clear style and color attributes. + + borderPaletteColor = undefined; + newStyle.border.color = undefined; + newStyle.border.style = 'none'; + } + + if (!hasZeroWidth && hadPreviousZeroWidth) { + // Restore previous border style selection if width is now not zero and + // border style was 'none'. This is to support changes to the UI which + // change the border style UI to a segmented control without a "none" + // option. + if (borderStyle === 'none') { + newStyle.border.style = styleSelection; + } // Restore previous border color selection if width is no longer zero + // and current border color is undefined. + + + if (borderColor === undefined) { + borderPaletteColor = colorSelection; + newStyle.border.color = customColorSelection; + } + } // If width was reset, clean out undefined styles. + + + if (newWidth === undefined || newWidth === '') { + newStyle = cleanEmptyObject(newStyle); + } + + setAttributes({ + borderColor: borderPaletteColor, + style: newStyle + }); + }; + + const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ + availableUnits: useSetting('spacing.units') || ['px', 'em', 'rem'] + }); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { + value: width, + label: (0,external_wp_i18n_namespaceObject.__)('Width'), + min: MIN_BORDER_WIDTH, + onChange: onChange, + units: units + }); +}; +/** + * Checks if there is a current value in the border width block support + * attributes. + * + * @param {Object} props Block props. + * @return {boolean} Whether or not the block has a border width value set. + */ + +function hasBorderWidthValue(props) { + var _props$attributes$sty, _props$attributes$sty2; + + return !!((_props$attributes$sty = props.attributes.style) !== null && _props$attributes$sty !== void 0 && (_props$attributes$sty2 = _props$attributes$sty.border) !== null && _props$attributes$sty2 !== void 0 && _props$attributes$sty2.width); +} +/** + * Resets the border width block support attribute. This can be used when + * disabling the border width support control for a block via a progressive + * discovery panel. + * + * @param {Object} props Block props. + * @param {Object} props.attributes Block's attributes. + * @param {Object} props.setAttributes Function to set block's attributes. + */ + +function resetBorderWidth(_ref) { + let { + attributes = {}, + setAttributes + } = _ref; + const { + style + } = attributes; + setAttributes({ + style: removeBorderAttribute(style, 'width') + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/border.js + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + + + + + +const BORDER_SUPPORT_KEY = '__experimentalBorder'; +function BorderPanel(props) { + const { + clientId + } = props; + const isColorSupported = useSetting('border.color') && hasBorderSupport(props.name, 'color'); + const isRadiusSupported = useSetting('border.radius') && hasBorderSupport(props.name, 'radius'); + const isStyleSupported = useSetting('border.style') && hasBorderSupport(props.name, 'style'); + const isWidthSupported = useSetting('border.width') && hasBorderSupport(props.name, 'width'); + const isDisabled = [!isColorSupported, !isRadiusSupported, !isStyleSupported, !isWidthSupported].every(Boolean); + + if (isDisabled) { + return null; + } + + const defaultBorderControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(props.name, [BORDER_SUPPORT_KEY, '__experimentalDefaultControls']); + + const createResetAllFilter = function (borderAttribute) { + let topLevelAttributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + return newAttributes => { + var _newAttributes$style; + + return { ...newAttributes, + ...topLevelAttributes, + style: { ...newAttributes.style, + border: { ...((_newAttributes$style = newAttributes.style) === null || _newAttributes$style === void 0 ? void 0 : _newAttributes$style.border), + [borderAttribute]: undefined + } + } + }; + }; + }; + + return (0,external_wp_element_namespaceObject.createElement)(inspector_controls, { + __experimentalGroup: "border" + }, isWidthSupported && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + className: "single-column", + hasValue: () => hasBorderWidthValue(props), + label: (0,external_wp_i18n_namespaceObject.__)('Width'), + onDeselect: () => resetBorderWidth(props), + isShownByDefault: defaultBorderControls === null || defaultBorderControls === void 0 ? void 0 : defaultBorderControls.width, + resetAllFilter: createResetAllFilter('width'), + panelId: clientId + }, (0,external_wp_element_namespaceObject.createElement)(BorderWidthEdit, props)), isStyleSupported && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + className: "single-column", + hasValue: () => hasBorderStyleValue(props), + label: (0,external_wp_i18n_namespaceObject.__)('Style'), + onDeselect: () => resetBorderStyle(props), + isShownByDefault: defaultBorderControls === null || defaultBorderControls === void 0 ? void 0 : defaultBorderControls.style, + resetAllFilter: createResetAllFilter('style'), + panelId: clientId + }, (0,external_wp_element_namespaceObject.createElement)(BorderStyleEdit, props)), isColorSupported && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + hasValue: () => hasBorderColorValue(props), + label: (0,external_wp_i18n_namespaceObject.__)('Color'), + onDeselect: () => resetBorderColor(props), + isShownByDefault: defaultBorderControls === null || defaultBorderControls === void 0 ? void 0 : defaultBorderControls.color, + resetAllFilter: createResetAllFilter('color', { + borderColor: undefined + }), + panelId: clientId + }, (0,external_wp_element_namespaceObject.createElement)(BorderColorEdit, props)), isRadiusSupported && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + hasValue: () => hasBorderRadiusValue(props), + label: (0,external_wp_i18n_namespaceObject.__)('Radius'), + onDeselect: () => resetBorderRadius(props), + isShownByDefault: defaultBorderControls === null || defaultBorderControls === void 0 ? void 0 : defaultBorderControls.radius, + resetAllFilter: createResetAllFilter('radius'), + panelId: clientId + }, (0,external_wp_element_namespaceObject.createElement)(BorderRadiusEdit, props))); +} +/** + * Determine whether there is block support for border properties. + * + * @param {string} blockName Block name. + * @param {string} feature Border feature to check support for. + * + * @return {boolean} Whether there is support. + */ + +function hasBorderSupport(blockName) { + let feature = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'any'; + + if (external_wp_element_namespaceObject.Platform.OS !== 'web') { + return false; + } + + const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, BORDER_SUPPORT_KEY); + + if (support === true) { + return true; + } + + if (feature === 'any') { + return !!(support !== null && support !== void 0 && support.color || support !== null && support !== void 0 && support.radius || support !== null && support !== void 0 && support.width || support !== null && support !== void 0 && support.style); + } + + return !!(support !== null && support !== void 0 && support[feature]); +} +/** + * Returns a new style object where the specified border attribute has been + * removed. + * + * @param {Object} style Styles from block attributes. + * @param {string} attribute The border style attribute to clear. + * + * @return {Object} Style object with the specified attribute removed. + */ + +function removeBorderAttribute(style, attribute) { + return cleanEmptyObject({ ...style, + border: { ...(style === null || style === void 0 ? void 0 : style.border), + [attribute]: undefined + } + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/gradients/use-gradient.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + +function __experimentalGetGradientClass(gradientSlug) { + if (!gradientSlug) { + return undefined; + } + + return `has-${gradientSlug}-gradient-background`; +} +/** + * Retrieves the gradient value per slug. + * + * @param {Array} gradients Gradient Palette + * @param {string} slug Gradient slug + * + * @return {string} Gradient value. + */ + +function getGradientValueBySlug(gradients, slug) { + const gradient = (0,external_lodash_namespaceObject.find)(gradients, ['slug', slug]); + return gradient && gradient.gradient; +} +function __experimentalGetGradientObjectByGradientValue(gradients, value) { + const gradient = (0,external_lodash_namespaceObject.find)(gradients, ['gradient', value]); + return gradient; +} +/** + * Retrieves the gradient slug per slug. + * + * @param {Array} gradients Gradient Palette + * @param {string} value Gradient value + * @return {string} Gradient slug. + */ + +function getGradientSlugByValue(gradients, value) { + const gradient = __experimentalGetGradientObjectByGradientValue(gradients, value); + + return gradient && gradient.slug; +} +function __experimentalUseGradient() { + let { + gradientAttribute = 'gradient', + customGradientAttribute = 'customGradient' + } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + const { + clientId + } = useBlockEditContext(); + const userGradientPalette = useSetting('color.gradients.custom'); + const themeGradientPalette = useSetting('color.gradients.theme'); + const defaultGradientPalette = useSetting('color.gradients.default'); + const allGradients = (0,external_wp_element_namespaceObject.useMemo)(() => [...(userGradientPalette || []), ...(themeGradientPalette || []), ...(defaultGradientPalette || [])], [userGradientPalette, themeGradientPalette, defaultGradientPalette]); + const { + gradient, + customGradient + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getBlockAttributes + } = select(store); + const attributes = getBlockAttributes(clientId) || {}; + return { + customGradient: attributes[customGradientAttribute], + gradient: attributes[gradientAttribute] + }; + }, [clientId, gradientAttribute, customGradientAttribute]); + const { + updateBlockAttributes + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const setGradient = (0,external_wp_element_namespaceObject.useCallback)(newGradientValue => { + const slug = getGradientSlugByValue(allGradients, newGradientValue); + + if (slug) { + updateBlockAttributes(clientId, { + [gradientAttribute]: slug, + [customGradientAttribute]: undefined + }); + return; + } + + updateBlockAttributes(clientId, { + [gradientAttribute]: undefined, + [customGradientAttribute]: newGradientValue + }); + }, [allGradients, clientId, updateBlockAttributes]); + + const gradientClass = __experimentalGetGradientClass(gradient); + + let gradientValue; + + if (gradient) { + gradientValue = getGradientValueBySlug(allGradients, gradient); + } else { + gradientValue = customGradient; + } + + return { + gradientClass, + gradientValue, + setGradient + }; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/contrast-checker/index.js + + +/** + * External dependencies + */ + + + +/** + * WordPress dependencies + */ + + + + +k([names, a11y]); + +function ContrastChecker(_ref) { + let { + backgroundColor, + fallbackBackgroundColor, + fallbackTextColor, + fallbackLinkColor, + fontSize, + // Font size value in pixels. + isLargeText, + textColor, + linkColor, + enableAlphaChecker = false + } = _ref; + const currentBackgroundColor = backgroundColor || fallbackBackgroundColor; // Must have a background color. + + if (!currentBackgroundColor) { + return null; + } + + const currentTextColor = textColor || fallbackTextColor; + const currentLinkColor = linkColor || fallbackLinkColor; // Must have at least one text color. + + if (!currentTextColor && !currentLinkColor) { + return null; + } + + const textColors = [{ + color: currentTextColor, + description: (0,external_wp_i18n_namespaceObject.__)('text color') + }, { + color: currentLinkColor, + description: (0,external_wp_i18n_namespaceObject.__)('link color') + }]; + const colordBackgroundColor = w(currentBackgroundColor); + const backgroundColorHasTransparency = colordBackgroundColor.alpha() < 1; + const backgroundColorBrightness = colordBackgroundColor.brightness(); + const isReadableOptions = { + level: 'AA', + size: isLargeText || isLargeText !== false && fontSize >= 24 ? 'large' : 'small' + }; + let message = ''; + let speakMessage = ''; + + for (const item of textColors) { + // If there is no color, go no further. + if (!item.color) { + continue; + } + + const colordTextColor = w(item.color); + const isColordTextReadable = colordTextColor.isReadable(colordBackgroundColor, isReadableOptions); + const textHasTransparency = colordTextColor.alpha() < 1; // If the contrast is not readable. + + if (!isColordTextReadable) { + // Don't show the message if the background or text is transparent. + if (backgroundColorHasTransparency || textHasTransparency) { + continue; + } + + message = backgroundColorBrightness < colordTextColor.brightness() ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s is a type of text color, e.g., "text color" or "link color". + (0,external_wp_i18n_namespaceObject.__)('This color combination may be hard for people to read. Try using a darker background color and/or a brighter %s.'), item.description) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s is a type of text color, e.g., "text color" or "link color". + (0,external_wp_i18n_namespaceObject.__)('This color combination may be hard for people to read. Try using a brighter background color and/or a darker %s.'), item.description); + speakMessage = (0,external_wp_i18n_namespaceObject.__)('This color combination may be hard for people to read.'); // Break from the loop when we have a contrast warning. + // These messages take priority over the transparency warning. + + break; + } // If there is no contrast warning and the text is transparent, + // show the transparent warning if alpha check is enabled. + + + if (textHasTransparency && enableAlphaChecker) { + message = (0,external_wp_i18n_namespaceObject.__)('Transparent text may be hard for people to read.'); + speakMessage = (0,external_wp_i18n_namespaceObject.__)('Transparent text may be hard for people to read.'); + } + } + + if (!message) { + return null; + } // Note: The `Notice` component can speak messages via its `spokenMessage` + // prop, but the contrast checker requires granular control over when the + // announcements are made. Notably, the message will be re-announced if a + // new color combination is selected and the contrast is still insufficient. + + + (0,external_wp_a11y_namespaceObject.speak)(speakMessage); + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-contrast-checker" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, { + spokenMessage: null, + status: "warning", + isDismissible: false + }, message)); +} +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/contrast-checker/README.md + */ + + +/* harmony default export */ var contrast_checker = (ContrastChecker); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/tools-panel-color-dropdown.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + +function ToolsPanelColorDropdown(_ref) { + var _settings$gradientVal; + + let { + settings, + enableAlpha, + ...otherProps + } = _ref; + const colorGradientSettings = useMultipleOriginColorsAndGradients(); + const controlSettings = { ...colorGradientSettings, + clearable: false, + enableAlpha, + label: settings.label, + onColorChange: settings.onColorChange, + onGradientChange: settings.onGradientChange, + colorValue: settings.colorValue, + gradientValue: settings.gradientValue + }; + const selectedColor = (_settings$gradientVal = settings.gradientValue) !== null && _settings$gradientVal !== void 0 ? _settings$gradientVal : settings.colorValue; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, _extends({ + hasValue: settings.hasValue, + label: settings.label, + onDeselect: settings.onDeselect, + isShownByDefault: settings.isShownByDefault, + resetAllFilter: settings.resetAllFilter + }, otherProps, { + className: "block-editor-tools-panel-color-gradient-settings__item" + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { + className: "block-editor-tools-panel-color-dropdown", + contentClassName: "block-editor-panel-color-gradient-settings__dropdown-content", + renderToggle: _ref2 => { + let { + isOpen, + onToggle + } = _ref2; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + onClick: onToggle, + "aria-expanded": isOpen, + className: classnames_default()('block-editor-panel-color-gradient-settings__dropdown', { + 'is-open': isOpen + }) + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { + justify: "flex-start" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, { + className: "block-editor-panel-color-gradient-settings__color-indicator", + colorValue: selectedColor + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, settings.label))); + }, + renderContent: () => (0,external_wp_element_namespaceObject.createElement)(control, _extends({ + showTitle: false, + __experimentalHasMultipleOrigins: true, + __experimentalIsRenderedInSidebar: true, + enableAlpha: true + }, controlSettings)) + })); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/color-panel.js + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + + + + +function getComputedStyle(node) { + return node.ownerDocument.defaultView.getComputedStyle(node); +} + +function ColorPanel(_ref) { + let { + enableAlpha = false, + settings, + clientId, + enableContrastChecking = true + } = _ref; + const [detectedBackgroundColor, setDetectedBackgroundColor] = (0,external_wp_element_namespaceObject.useState)(); + const [detectedColor, setDetectedColor] = (0,external_wp_element_namespaceObject.useState)(); + const [detectedLinkColor, setDetectedLinkColor] = (0,external_wp_element_namespaceObject.useState)(); + const ref = useBlockRef(clientId); + (0,external_wp_element_namespaceObject.useEffect)(() => { + var _ref$current; + + if (!enableContrastChecking) { + return; + } + + if (!ref.current) { + return; + } + + setDetectedColor(getComputedStyle(ref.current).color); + const firstLinkElement = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.querySelector('a'); + + if (firstLinkElement && !!firstLinkElement.innerText) { + setDetectedLinkColor(getComputedStyle(firstLinkElement).color); + } + + let backgroundColorNode = ref.current; + let backgroundColor = getComputedStyle(backgroundColorNode).backgroundColor; + + while (backgroundColor === 'rgba(0, 0, 0, 0)' && backgroundColorNode.parentNode && backgroundColorNode.parentNode.nodeType === backgroundColorNode.parentNode.ELEMENT_NODE) { + backgroundColorNode = backgroundColorNode.parentNode; + backgroundColor = getComputedStyle(backgroundColorNode).backgroundColor; + } + + setDetectedBackgroundColor(backgroundColor); + }); + return (0,external_wp_element_namespaceObject.createElement)(inspector_controls, { + __experimentalGroup: "color" + }, settings.map((setting, index) => (0,external_wp_element_namespaceObject.createElement)(ToolsPanelColorDropdown, { + key: index, + settings: setting, + panelId: clientId, + enableAlpha: enableAlpha + })), enableContrastChecking && (0,external_wp_element_namespaceObject.createElement)(contrast_checker, { + backgroundColor: detectedBackgroundColor, + textColor: detectedColor, + enableAlphaChecker: enableAlpha, + linkColor: detectedLinkColor + })); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/color.js + + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + + + + +const COLOR_SUPPORT_KEY = 'color'; + +const hasColorSupport = blockType => { + const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY); + return colorSupport && (colorSupport.link === true || colorSupport.gradient === true || colorSupport.background !== false || colorSupport.text !== false); +}; + +const hasLinkColorSupport = blockType => { + if (external_wp_element_namespaceObject.Platform.OS !== 'web') { + return false; + } + + const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY); + return (0,external_lodash_namespaceObject.isObject)(colorSupport) && !!colorSupport.link; +}; + +const hasGradientSupport = blockType => { + const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY); + return (0,external_lodash_namespaceObject.isObject)(colorSupport) && !!colorSupport.gradients; +}; + +const hasBackgroundColorSupport = blockType => { + const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY); + return colorSupport && colorSupport.background !== false; +}; + +const hasTextColorSupport = blockType => { + const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY); + return colorSupport && colorSupport.text !== false; +}; +/** + * Checks whether a color has been set either with a named preset color in + * a top level block attribute or as a custom value within the style attribute + * object. + * + * @param {string} name Name of the color to check. + * @return {boolean} Whether or not a color has a value. + */ + + +const hasColor = name => props => { + var _props$attributes$sty9, _props$attributes$sty10; + + if (name === 'background') { + var _props$attributes$sty, _props$attributes$sty2, _props$attributes$sty3, _props$attributes$sty4; + + return !!props.attributes.backgroundColor || !!((_props$attributes$sty = props.attributes.style) !== null && _props$attributes$sty !== void 0 && (_props$attributes$sty2 = _props$attributes$sty.color) !== null && _props$attributes$sty2 !== void 0 && _props$attributes$sty2.background) || !!props.attributes.gradient || !!((_props$attributes$sty3 = props.attributes.style) !== null && _props$attributes$sty3 !== void 0 && (_props$attributes$sty4 = _props$attributes$sty3.color) !== null && _props$attributes$sty4 !== void 0 && _props$attributes$sty4.gradient); + } + + if (name === 'link') { + var _props$attributes$sty5, _props$attributes$sty6, _props$attributes$sty7, _props$attributes$sty8; + + return !!((_props$attributes$sty5 = props.attributes.style) !== null && _props$attributes$sty5 !== void 0 && (_props$attributes$sty6 = _props$attributes$sty5.elements) !== null && _props$attributes$sty6 !== void 0 && (_props$attributes$sty7 = _props$attributes$sty6.link) !== null && _props$attributes$sty7 !== void 0 && (_props$attributes$sty8 = _props$attributes$sty7.color) !== null && _props$attributes$sty8 !== void 0 && _props$attributes$sty8.text); + } + + return !!props.attributes[`${name}Color`] || !!((_props$attributes$sty9 = props.attributes.style) !== null && _props$attributes$sty9 !== void 0 && (_props$attributes$sty10 = _props$attributes$sty9.color) !== null && _props$attributes$sty10 !== void 0 && _props$attributes$sty10[name]); +}; +/** + * Clears a single color property from a style object. + * + * @param {Array} path Path to color property to clear within styles object. + * @param {Object} style Block attributes style object. + * @return {Object} Styles with the color property omitted. + */ + + +const clearColorFromStyles = (path, style) => cleanEmptyObject(immutableSet(style, path, undefined)); +/** + * Resets the block attributes for text color. + * + * @param {Object} props Current block props. + * @param {Object} props.attributes Block attributes. + * @param {Function} props.setAttributes Block's setAttributes prop used to apply reset. + */ + + +const resetTextColor = _ref => { + let { + attributes, + setAttributes + } = _ref; + setAttributes({ + textColor: undefined, + style: clearColorFromStyles(['color', 'text'], attributes.style) + }); +}; +/** + * Clears text color related properties from supplied attributes. + * + * @param {Object} attributes Block attributes. + * @return {Object} Update block attributes with text color properties omitted. + */ + + +const resetAllTextFilter = attributes => ({ + textColor: undefined, + style: clearColorFromStyles(['color', 'text'], attributes.style) +}); +/** + * Resets the block attributes for link color. + * + * @param {Object} props Current block props. + * @param {Object} props.attributes Block attributes. + * @param {Function} props.setAttributes Block's setAttributes prop used to apply reset. + */ + + +const resetLinkColor = _ref2 => { + let { + attributes, + setAttributes + } = _ref2; + const path = ['elements', 'link', 'color', 'text']; + setAttributes({ + style: clearColorFromStyles(path, attributes.style) + }); +}; +/** + * Clears link color related properties from supplied attributes. + * + * @param {Object} attributes Block attributes. + * @return {Object} Update block attributes with link color properties omitted. + */ + + +const resetAllLinkFilter = attributes => ({ + style: clearColorFromStyles(['elements', 'link', 'color', 'text'], attributes.style) +}); +/** + * Clears all background color related properties including gradients from + * supplied block attributes. + * + * @param {Object} attributes Block attributes. + * @return {Object} Block attributes with background and gradient omitted. + */ + + +const clearBackgroundAndGradient = attributes => { + var _attributes$style; + + return { + backgroundColor: undefined, + gradient: undefined, + style: { ...attributes.style, + color: { ...((_attributes$style = attributes.style) === null || _attributes$style === void 0 ? void 0 : _attributes$style.color), + background: undefined, + gradient: undefined + } + } + }; +}; +/** + * Resets the block attributes for both background color and gradient. + * + * @param {Object} props Current block props. + * @param {Object} props.attributes Block attributes. + * @param {Function} props.setAttributes Block's setAttributes prop used to apply reset. + */ + + +const resetBackgroundAndGradient = _ref3 => { + let { + attributes, + setAttributes + } = _ref3; + setAttributes(clearBackgroundAndGradient(attributes)); +}; +/** + * Filters registered block settings, extending attributes to include + * `backgroundColor` and `textColor` attribute. + * + * @param {Object} settings Original block settings. + * + * @return {Object} Filtered block settings. + */ + + +function color_addAttributes(settings) { + if (!hasColorSupport(settings)) { + return settings; + } // Allow blocks to specify their own attribute definition with default values if needed. + + + if (!settings.attributes.backgroundColor) { + Object.assign(settings.attributes, { + backgroundColor: { + type: 'string' + } + }); + } + + if (!settings.attributes.textColor) { + Object.assign(settings.attributes, { + textColor: { + type: 'string' + } + }); + } + + if (hasGradientSupport(settings) && !settings.attributes.gradient) { + Object.assign(settings.attributes, { + gradient: { + type: 'string' + } + }); + } + + return settings; +} +/** + * Override props assigned to save component to inject colors classnames. + * + * @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 color_addSaveProps(props, blockType, attributes) { + var _style$color, _style$color2, _style$color3, _style$color4, _style$elements, _style$elements$link; + + if (!hasColorSupport(blockType) || shouldSkipSerialization(blockType, COLOR_SUPPORT_KEY)) { + return props; + } + + const hasGradient = hasGradientSupport(blockType); // I'd have preferred to avoid the "style" attribute usage here + + const { + backgroundColor, + textColor, + gradient, + style + } = attributes; + + const shouldSerialize = feature => !shouldSkipSerialization(blockType, COLOR_SUPPORT_KEY, feature); // Primary color classes must come before the `has-text-color`, + // `has-background` and `has-link-color` classes to maintain backwards + // compatibility and avoid block invalidations. + + + const textClass = shouldSerialize('text') ? getColorClassName('color', textColor) : undefined; + const gradientClass = shouldSerialize('gradients') ? __experimentalGetGradientClass(gradient) : undefined; + const backgroundClass = shouldSerialize('background') ? getColorClassName('background-color', backgroundColor) : undefined; + const serializeHasBackground = shouldSerialize('background') || shouldSerialize('gradients'); + const hasBackground = backgroundColor || (style === null || style === void 0 ? void 0 : (_style$color = style.color) === null || _style$color === void 0 ? void 0 : _style$color.background) || hasGradient && (gradient || (style === null || style === void 0 ? void 0 : (_style$color2 = style.color) === null || _style$color2 === void 0 ? void 0 : _style$color2.gradient)); + const newClassName = classnames_default()(props.className, textClass, gradientClass, { + // Don't apply the background class if there's a custom gradient. + [backgroundClass]: (!hasGradient || !(style !== null && style !== void 0 && (_style$color3 = style.color) !== null && _style$color3 !== void 0 && _style$color3.gradient)) && !!backgroundClass, + 'has-text-color': shouldSerialize('text') && (textColor || (style === null || style === void 0 ? void 0 : (_style$color4 = style.color) === null || _style$color4 === void 0 ? void 0 : _style$color4.text)), + 'has-background': serializeHasBackground && hasBackground, + 'has-link-color': shouldSerialize('link') && (style === null || style === void 0 ? void 0 : (_style$elements = style.elements) === null || _style$elements === void 0 ? void 0 : (_style$elements$link = _style$elements.link) === null || _style$elements$link === void 0 ? void 0 : _style$elements$link.color) + }); + props.className = newClassName ? newClassName : undefined; + return props; +} +/** + * Filters registered block settings to extend the block edit wrapper + * to apply the desired styles and classnames properly. + * + * @param {Object} settings Original block settings. + * + * @return {Object} Filtered block settings. + */ + +function color_addEditProps(settings) { + if (!hasColorSupport(settings) || shouldSkipSerialization(settings, COLOR_SUPPORT_KEY)) { + return settings; + } + + const existingGetEditWrapperProps = settings.getEditWrapperProps; + + settings.getEditWrapperProps = attributes => { + let props = {}; + + if (existingGetEditWrapperProps) { + props = existingGetEditWrapperProps(attributes); + } + + return color_addSaveProps(props, settings, attributes); + }; + + return settings; +} + +const getLinkColorFromAttributeValue = (colors, value) => { + const attributeParsed = /var:preset\|color\|(.+)/.exec(value); + + if (attributeParsed && attributeParsed[1]) { + return getColorObjectByAttributeValues(colors, attributeParsed[1]).color; + } + + return value; +}; +/** + * Inspector control panel containing the color related configuration + * + * @param {Object} props + * + * @return {WPElement} Color edit element. + */ + + +function ColorEdit(props) { + var _style$color6, _style$color7, _style$color8, _style$elements2, _style$elements2$link, _style$elements2$link2, _style$elements3, _style$elements3$link, _style$elements3$link2; + + const { + name: blockName, + attributes + } = props; // Some color settings have a special handling for deprecated flags in `useSetting`, + // so we can't unwrap them by doing const { ... } = useSetting('color') + // until https://github.com/WordPress/gutenberg/issues/37094 is fixed. + + const userPalette = useSetting('color.palette.custom'); + const themePalette = useSetting('color.palette.theme'); + const defaultPalette = useSetting('color.palette.default'); + const allSolids = (0,external_wp_element_namespaceObject.useMemo)(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]); + const userGradientPalette = useSetting('color.gradients.custom'); + const themeGradientPalette = useSetting('color.gradients.theme'); + const defaultGradientPalette = useSetting('color.gradients.default'); + const allGradients = (0,external_wp_element_namespaceObject.useMemo)(() => [...(userGradientPalette || []), ...(themeGradientPalette || []), ...(defaultGradientPalette || [])], [userGradientPalette, themeGradientPalette, defaultGradientPalette]); + const areCustomSolidsEnabled = useSetting('color.custom'); + const areCustomGradientsEnabled = useSetting('color.customGradient'); + const isBackgroundEnabled = useSetting('color.background'); + const isLinkEnabled = useSetting('color.link'); + const isTextEnabled = useSetting('color.text'); + const solidsEnabled = areCustomSolidsEnabled || !themePalette || (themePalette === null || themePalette === void 0 ? void 0 : themePalette.length) > 0; + const gradientsEnabled = areCustomGradientsEnabled || !themeGradientPalette || (themeGradientPalette === null || themeGradientPalette === void 0 ? void 0 : themeGradientPalette.length) > 0; // Shouldn't be needed but right now the ColorGradientsPanel + // can trigger both onChangeColor and onChangeBackground + // synchronously causing our two callbacks to override changes + // from each other. + + const localAttributes = (0,external_wp_element_namespaceObject.useRef)(attributes); + (0,external_wp_element_namespaceObject.useEffect)(() => { + localAttributes.current = attributes; + }, [attributes]); + + if (!hasColorSupport(blockName)) { + return null; + } + + const hasLinkColor = hasLinkColorSupport(blockName) && isLinkEnabled && solidsEnabled; + const hasTextColor = hasTextColorSupport(blockName) && isTextEnabled && solidsEnabled; + const hasBackgroundColor = hasBackgroundColorSupport(blockName) && isBackgroundEnabled && solidsEnabled; + const hasGradientColor = hasGradientSupport(blockName) && gradientsEnabled; + + if (!hasLinkColor && !hasTextColor && !hasBackgroundColor && !hasGradientColor) { + return null; + } + + const { + style, + textColor, + backgroundColor, + gradient + } = attributes; + let gradientValue; + + if (hasGradientColor && gradient) { + gradientValue = getGradientValueBySlug(allGradients, gradient); + } else if (hasGradientColor) { + var _style$color5; + + gradientValue = style === null || style === void 0 ? void 0 : (_style$color5 = style.color) === null || _style$color5 === void 0 ? void 0 : _style$color5.gradient; + } + + const onChangeColor = name => value => { + var _localAttributes$curr, _localAttributes$curr2; + + const colorObject = getColorObjectByColorValue(allSolids, value); + const attributeName = name + 'Color'; + const newStyle = { ...localAttributes.current.style, + color: { ...((_localAttributes$curr = localAttributes.current) === null || _localAttributes$curr === void 0 ? void 0 : (_localAttributes$curr2 = _localAttributes$curr.style) === null || _localAttributes$curr2 === void 0 ? void 0 : _localAttributes$curr2.color), + [name]: colorObject !== null && colorObject !== void 0 && colorObject.slug ? undefined : value + } + }; + const newNamedColor = colorObject !== null && colorObject !== void 0 && colorObject.slug ? colorObject.slug : undefined; + const newAttributes = { + style: cleanEmptyObject(newStyle), + [attributeName]: newNamedColor + }; + props.setAttributes(newAttributes); + localAttributes.current = { ...localAttributes.current, + ...newAttributes + }; + }; + + const onChangeGradient = value => { + const slug = getGradientSlugByValue(allGradients, value); + let newAttributes; + + if (slug) { + var _localAttributes$curr3, _localAttributes$curr4, _localAttributes$curr5; + + const newStyle = { ...((_localAttributes$curr3 = localAttributes.current) === null || _localAttributes$curr3 === void 0 ? void 0 : _localAttributes$curr3.style), + color: { ...((_localAttributes$curr4 = localAttributes.current) === null || _localAttributes$curr4 === void 0 ? void 0 : (_localAttributes$curr5 = _localAttributes$curr4.style) === null || _localAttributes$curr5 === void 0 ? void 0 : _localAttributes$curr5.color), + gradient: undefined + } + }; + newAttributes = { + style: cleanEmptyObject(newStyle), + gradient: slug + }; + } else { + var _localAttributes$curr6, _localAttributes$curr7, _localAttributes$curr8; + + const newStyle = { ...((_localAttributes$curr6 = localAttributes.current) === null || _localAttributes$curr6 === void 0 ? void 0 : _localAttributes$curr6.style), + color: { ...((_localAttributes$curr7 = localAttributes.current) === null || _localAttributes$curr7 === void 0 ? void 0 : (_localAttributes$curr8 = _localAttributes$curr7.style) === null || _localAttributes$curr8 === void 0 ? void 0 : _localAttributes$curr8.color), + gradient: value + } + }; + newAttributes = { + style: cleanEmptyObject(newStyle), + gradient: undefined + }; + } + + props.setAttributes(newAttributes); + localAttributes.current = { ...localAttributes.current, + ...newAttributes + }; + }; + + const onChangeLinkColor = value => { + const colorObject = getColorObjectByColorValue(allSolids, value); + const newLinkColorValue = colorObject !== null && colorObject !== void 0 && colorObject.slug ? `var:preset|color|${colorObject.slug}` : value; + const newStyle = cleanEmptyObject(immutableSet(style, ['elements', 'link', 'color', 'text'], newLinkColorValue)); + props.setAttributes({ + style: newStyle + }); + }; + + const enableContrastChecking = external_wp_element_namespaceObject.Platform.OS === 'web' && !gradient && !(style !== null && style !== void 0 && (_style$color6 = style.color) !== null && _style$color6 !== void 0 && _style$color6.gradient); + const defaultColorControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(props.name, [COLOR_SUPPORT_KEY, '__experimentalDefaultControls']); + return (0,external_wp_element_namespaceObject.createElement)(ColorPanel, { + enableContrastChecking: enableContrastChecking, + clientId: props.clientId, + enableAlpha: true, + settings: [...(hasTextColor ? [{ + label: (0,external_wp_i18n_namespaceObject.__)('Text'), + onColorChange: onChangeColor('text'), + colorValue: getColorObjectByAttributeValues(allSolids, textColor, style === null || style === void 0 ? void 0 : (_style$color7 = style.color) === null || _style$color7 === void 0 ? void 0 : _style$color7.text).color, + isShownByDefault: defaultColorControls === null || defaultColorControls === void 0 ? void 0 : defaultColorControls.text, + hasValue: () => hasColor('text')(props), + onDeselect: () => resetTextColor(props), + resetAllFilter: resetAllTextFilter + }] : []), ...(hasBackgroundColor || hasGradientColor ? [{ + label: (0,external_wp_i18n_namespaceObject.__)('Background'), + onColorChange: hasBackgroundColor ? onChangeColor('background') : undefined, + colorValue: getColorObjectByAttributeValues(allSolids, backgroundColor, style === null || style === void 0 ? void 0 : (_style$color8 = style.color) === null || _style$color8 === void 0 ? void 0 : _style$color8.background).color, + gradientValue, + onGradientChange: hasGradientColor ? onChangeGradient : undefined, + isShownByDefault: defaultColorControls === null || defaultColorControls === void 0 ? void 0 : defaultColorControls.background, + hasValue: () => hasColor('background')(props), + onDeselect: () => resetBackgroundAndGradient(props), + resetAllFilter: clearBackgroundAndGradient + }] : []), ...(hasLinkColor ? [{ + label: (0,external_wp_i18n_namespaceObject.__)('Link'), + onColorChange: onChangeLinkColor, + colorValue: getLinkColorFromAttributeValue(allSolids, style === null || style === void 0 ? void 0 : (_style$elements2 = style.elements) === null || _style$elements2 === void 0 ? void 0 : (_style$elements2$link = _style$elements2.link) === null || _style$elements2$link === void 0 ? void 0 : (_style$elements2$link2 = _style$elements2$link.color) === null || _style$elements2$link2 === void 0 ? void 0 : _style$elements2$link2.text), + clearable: !!(style !== null && style !== void 0 && (_style$elements3 = style.elements) !== null && _style$elements3 !== void 0 && (_style$elements3$link = _style$elements3.link) !== null && _style$elements3$link !== void 0 && (_style$elements3$link2 = _style$elements3$link.color) !== null && _style$elements3$link2 !== void 0 && _style$elements3$link2.text), + isShownByDefault: defaultColorControls === null || defaultColorControls === void 0 ? void 0 : defaultColorControls.link, + hasValue: () => hasColor('link')(props), + onDeselect: () => resetLinkColor(props), + resetAllFilter: resetAllLinkFilter + }] : [])] + }); +} +/** + * This adds inline styles for color palette colors. + * Ideally, this is not needed and themes should load their palettes on the editor. + * + * @param {Function} BlockListBlock Original component. + * + * @return {Function} Wrapped component. + */ + +const withColorPaletteStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockListBlock => props => { + var _props$wrapperProps; + + const { + name, + attributes + } = props; + const { + backgroundColor, + textColor + } = attributes; + const userPalette = useSetting('color.palette.custom') || []; + const themePalette = useSetting('color.palette.theme') || []; + const defaultPalette = useSetting('color.palette.default') || []; + const colors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]); + + if (!hasColorSupport(name) || shouldSkipSerialization(name, COLOR_SUPPORT_KEY)) { + return (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, props); + } + + const extraStyles = {}; + + if (textColor && !shouldSkipSerialization(name, COLOR_SUPPORT_KEY, 'text')) { + var _getColorObjectByAttr; + + extraStyles.color = (_getColorObjectByAttr = getColorObjectByAttributeValues(colors, textColor)) === null || _getColorObjectByAttr === void 0 ? void 0 : _getColorObjectByAttr.color; + } + + if (backgroundColor && !shouldSkipSerialization(name, COLOR_SUPPORT_KEY, 'background')) { + var _getColorObjectByAttr2; + + extraStyles.backgroundColor = (_getColorObjectByAttr2 = getColorObjectByAttributeValues(colors, backgroundColor)) === null || _getColorObjectByAttr2 === void 0 ? void 0 : _getColorObjectByAttr2.color; + } + + let wrapperProps = props.wrapperProps; + wrapperProps = { ...props.wrapperProps, + style: { ...extraStyles, + ...((_props$wrapperProps = props.wrapperProps) === null || _props$wrapperProps === void 0 ? void 0 : _props$wrapperProps.style) + } + }; + return (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, _extends({}, props, { + wrapperProps: wrapperProps + })); +}); +const MIGRATION_PATHS = { + linkColor: [['style', 'elements', 'link', 'color', 'text']], + textColor: [['textColor'], ['style', 'color', 'text']], + backgroundColor: [['backgroundColor'], ['style', 'color', 'background']], + gradient: [['gradient'], ['style', 'color', 'gradient']] +}; +function color_addTransforms(result, source, index, results) { + const destinationBlockType = result.name; + const activeSupports = { + linkColor: hasLinkColorSupport(destinationBlockType), + textColor: hasTextColorSupport(destinationBlockType), + backgroundColor: hasBackgroundColorSupport(destinationBlockType), + gradient: hasGradientSupport(destinationBlockType) + }; + return transformStyles(activeSupports, MIGRATION_PATHS, result, source, index, results); +} +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/color/addAttribute', color_addAttributes); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/color/addSaveProps', color_addSaveProps); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/color/addEditProps', color_addEditProps); +(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/color/with-color-palette-styles', withColorPaletteStyles); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.switchToBlockType.transformedBlock', 'core/color/addTransforms', color_addTransforms); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-appearance-control/index.js + + +/** + * WordPress dependencies + */ + + + +const FONT_STYLES = [{ + name: (0,external_wp_i18n_namespaceObject._x)('Regular', 'font style'), + value: 'normal' +}, { + name: (0,external_wp_i18n_namespaceObject._x)('Italic', 'font style'), + value: 'italic' +}]; +const FONT_WEIGHTS = [{ + name: (0,external_wp_i18n_namespaceObject._x)('Thin', 'font weight'), + value: '100' +}, { + name: (0,external_wp_i18n_namespaceObject._x)('Extra Light', 'font weight'), + value: '200' +}, { + name: (0,external_wp_i18n_namespaceObject._x)('Light', 'font weight'), + value: '300' +}, { + name: (0,external_wp_i18n_namespaceObject._x)('Regular', 'font weight'), + value: '400' +}, { + name: (0,external_wp_i18n_namespaceObject._x)('Medium', 'font weight'), + value: '500' +}, { + name: (0,external_wp_i18n_namespaceObject._x)('Semi Bold', 'font weight'), + value: '600' +}, { + name: (0,external_wp_i18n_namespaceObject._x)('Bold', 'font weight'), + value: '700' +}, { + name: (0,external_wp_i18n_namespaceObject._x)('Extra Bold', 'font weight'), + value: '800' +}, { + name: (0,external_wp_i18n_namespaceObject._x)('Black', 'font weight'), + value: '900' +}]; +/** + * Adjusts font appearance field label in case either font styles or weights + * are disabled. + * + * @param {boolean} hasFontStyles Whether font styles are enabled and present. + * @param {boolean} hasFontWeights Whether font weights are enabled and present. + * @return {string} A label representing what font appearance is being edited. + */ + +const getFontAppearanceLabel = (hasFontStyles, hasFontWeights) => { + if (!hasFontStyles) { + return (0,external_wp_i18n_namespaceObject.__)('Font weight'); + } + + if (!hasFontWeights) { + return (0,external_wp_i18n_namespaceObject.__)('Font style'); + } + + return (0,external_wp_i18n_namespaceObject.__)('Appearance'); +}; +/** + * Control to display unified font style and weight options. + * + * @param {Object} props Component props. + * + * @return {WPElement} Font appearance control. + */ + +function FontAppearanceControl(props) { + const { + onChange, + hasFontStyles = true, + hasFontWeights = true, + value: { + fontStyle, + fontWeight + } + } = props; + const hasStylesOrWeights = hasFontStyles || hasFontWeights; + const label = getFontAppearanceLabel(hasFontStyles, hasFontWeights); + const defaultOption = { + key: 'default', + name: (0,external_wp_i18n_namespaceObject.__)('Default'), + style: { + fontStyle: undefined, + fontWeight: undefined + } + }; // Combines both font style and weight options into a single dropdown. + + const combineOptions = () => { + const combinedOptions = [defaultOption]; + FONT_STYLES.forEach(_ref => { + let { + name: styleName, + value: styleValue + } = _ref; + FONT_WEIGHTS.forEach(_ref2 => { + let { + name: weightName, + value: weightValue + } = _ref2; + const optionName = styleValue === 'normal' ? weightName : (0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: 1: Font weight name. 2: Font style name. */ + (0,external_wp_i18n_namespaceObject.__)('%1$s %2$s'), weightName, styleName); + combinedOptions.push({ + key: `${styleValue}-${weightValue}`, + name: optionName, + style: { + fontStyle: styleValue, + fontWeight: weightValue + } + }); + }); + }); + return combinedOptions; + }; // Generates select options for font styles only. + + + const styleOptions = () => { + const combinedOptions = [defaultOption]; + FONT_STYLES.forEach(_ref3 => { + let { + name, + value + } = _ref3; + combinedOptions.push({ + key: value, + name, + style: { + fontStyle: value, + fontWeight: undefined + } + }); + }); + return combinedOptions; + }; // Generates select options for font weights only. + + + const weightOptions = () => { + const combinedOptions = [defaultOption]; + FONT_WEIGHTS.forEach(_ref4 => { + let { + name, + value + } = _ref4; + combinedOptions.push({ + key: value, + name, + style: { + fontStyle: undefined, + fontWeight: value + } + }); + }); + return combinedOptions; + }; // Map font styles and weights to select options. + + + const selectOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { + if (hasFontStyles && hasFontWeights) { + return combineOptions(); + } + + return hasFontStyles ? styleOptions() : weightOptions(); + }, [props.options]); // Find current selection by comparing font style & weight against options, + // and fall back to the Default option if there is no matching option. + + const currentSelection = selectOptions.find(option => option.style.fontStyle === fontStyle && option.style.fontWeight === fontWeight) || selectOptions[0]; // Adjusts screen reader description based on styles or weights. + + const getDescribedBy = () => { + if (!currentSelection) { + return (0,external_wp_i18n_namespaceObject.__)('No selected font appearance'); + } + + if (!hasFontStyles) { + return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font weight. + (0,external_wp_i18n_namespaceObject.__)('Currently selected font weight: %s'), currentSelection.name); + } + + if (!hasFontWeights) { + return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font style. + (0,external_wp_i18n_namespaceObject.__)('Currently selected font style: %s'), currentSelection.name); + } + + return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font appearance. + (0,external_wp_i18n_namespaceObject.__)('Currently selected font appearance: %s'), currentSelection.name); + }; + + return hasStylesOrWeights && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CustomSelectControl, { + className: "components-font-appearance-control", + label: label, + describedBy: getDescribedBy(), + options: selectOptions, + value: currentSelection, + onChange: _ref5 => { + let { + selectedItem + } = _ref5; + return onChange(selectedItem.style); + } + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/line-height-control/utils.js +const BASE_DEFAULT_VALUE = 1.5; +const STEP = 0.1; +/** + * There are varying value types within LineHeightControl: + * + * {undefined} Initial value. No changes from the user. + * {string} Input value. Value consumed/outputted by the input. Empty would be ''. + * {number} Block attribute type. Input value needs to be converted for attribute setting. + * + * Note: If the value is undefined, the input requires it to be an empty string ('') + * in order to be considered "controlled" by props (rather than internal state). + */ + +const RESET_VALUE = ''; +/** + * Determines if the lineHeight attribute has been properly defined. + * + * @param {any} lineHeight The value to check. + * + * @return {boolean} Whether the lineHeight attribute is valid. + */ + +function isLineHeightDefined(lineHeight) { + return lineHeight !== undefined && lineHeight !== RESET_VALUE; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/line-height-control/index.js + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + +const LineHeightControl = _ref => { + let { + value: lineHeight, + onChange, + + /** Start opting into the new margin-free styles that will become the default in a future version. */ + __nextHasNoMarginBottom = false, + __unstableInputWidth = '60px' + } = _ref; + const isDefined = isLineHeightDefined(lineHeight); + + const adjustNextValue = (nextValue, wasTypedOrPasted) => { + // Set the next value without modification if lineHeight has been defined. + if (isDefined) return nextValue; + /** + * The following logic handles the initial step up/down action + * (from an undefined value state) so that the next values are better suited for + * line-height rendering. For example, the first step up should immediately + * go to 1.6, rather than the normally expected 0.1. + * + * Step up/down actions can be triggered by keydowns of the up/down arrow keys, + * or by clicking the spin buttons. + */ + + switch (`${nextValue}`) { + case `${STEP}`: + // Increment by step value. + return BASE_DEFAULT_VALUE + STEP; + + case '0': + { + // This means the user explicitly input '0', rather than stepped down + // from an undefined value state. + if (wasTypedOrPasted) return nextValue; // Decrement by step value. + + return BASE_DEFAULT_VALUE - STEP; + } + + case '': + return BASE_DEFAULT_VALUE; + + default: + return nextValue; + } + }; + + const stateReducer = (state, action) => { + var _action$payload$event; + + // Be careful when changing this — cross-browser behavior of the + // `inputType` field in `input` events are inconsistent. + // For example, Firefox emits an input event with inputType="insertReplacementText" + // on spin button clicks, while other browsers do not even emit an input event. + const wasTypedOrPasted = ['insertText', 'insertFromPaste'].includes((_action$payload$event = action.payload.event.nativeEvent) === null || _action$payload$event === void 0 ? void 0 : _action$payload$event.inputType); + const value = adjustNextValue(state.value, wasTypedOrPasted); + return { ...state, + value + }; + }; + + const value = isDefined ? lineHeight : RESET_VALUE; + + if (!__nextHasNoMarginBottom) { + external_wp_deprecated_default()('Bottom margin styles for wp.blockEditor.LineHeightControl', { + since: '6.0', + version: '6.4', + hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version' + }); + } + + const deprecatedStyles = __nextHasNoMarginBottom ? undefined : { + marginBottom: 24 + }; + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-line-height-control", + style: deprecatedStyles + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, { + __unstableInputWidth: __unstableInputWidth, + __unstableStateReducer: stateReducer, + onChange: onChange, + label: (0,external_wp_i18n_namespaceObject.__)('Line height'), + placeholder: BASE_DEFAULT_VALUE, + step: STEP, + value: value, + min: 0 + })); +}; +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/line-height-control/README.md + */ + + +/* harmony default export */ var line_height_control = (LineHeightControl); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/line-height.js + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + + +const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight'; +/** + * Inspector control panel containing the line height related configuration + * + * @param {Object} props + * + * @return {WPElement} Line height edit element. + */ + +function LineHeightEdit(props) { + var _style$typography; + + const { + attributes: { + style + }, + setAttributes + } = props; + + const onChange = newLineHeightValue => { + const newStyle = { ...style, + typography: { ...(style === null || style === void 0 ? void 0 : style.typography), + lineHeight: newLineHeightValue + } + }; + setAttributes({ + style: cleanEmptyObject(newStyle) + }); + }; + + return (0,external_wp_element_namespaceObject.createElement)(line_height_control, { + __unstableInputWidth: "100%", + __nextHasNoMarginBottom: true, + value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.lineHeight, + onChange: onChange + }); +} +/** + * Custom hook that checks if line-height settings have been disabled. + * + * @param {string} name The name of the block. + * @return {boolean} Whether setting is disabled. + */ + +function useIsLineHeightDisabled() { + let { + name: blockName + } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + const isDisabled = !useSetting('typography.lineHeight'); + return !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, LINE_HEIGHT_SUPPORT_KEY) || isDisabled; +} +/** + * Checks if there is a current value set for the line height block support. + * + * @param {Object} props Block props. + * @return {boolean} Whether or not the block has a line height value set. + */ + +function hasLineHeightValue(props) { + var _props$attributes$sty, _props$attributes$sty2; + + return !!((_props$attributes$sty = props.attributes.style) !== null && _props$attributes$sty !== void 0 && (_props$attributes$sty2 = _props$attributes$sty.typography) !== null && _props$attributes$sty2 !== void 0 && _props$attributes$sty2.lineHeight); +} +/** + * Resets the line height block support attribute. This can be used when + * disabling the line height support controls for a block via a progressive + * discovery panel. + * + * @param {Object} props Block props. + * @param {Object} props.attributes Block's attributes. + * @param {Object} props.setAttributes Function to set block's attributes. + */ + +function resetLineHeight(_ref) { + let { + attributes = {}, + setAttributes + } = _ref; + const { + style + } = attributes; + setAttributes({ + style: cleanEmptyObject({ ...style, + typography: { ...(style === null || style === void 0 ? void 0 : style.typography), + lineHeight: undefined + } + }) + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/font-appearance.js + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + + +/** + * Key within block settings' support array indicating support for font style. + */ + +const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle'; +/** + * Key within block settings' support array indicating support for font weight. + */ + +const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight'; +/** + * Inspector control panel containing the font appearance options. + * + * @param {Object} props Block properties. + * + * @return {WPElement} Font appearance edit element. + */ + +function FontAppearanceEdit(props) { + var _style$typography, _style$typography2; + + const { + attributes: { + style + }, + setAttributes + } = props; + const hasFontStyles = !useIsFontStyleDisabled(props); + const hasFontWeights = !useIsFontWeightDisabled(props); + + const onChange = newStyles => { + setAttributes({ + style: cleanEmptyObject({ ...style, + typography: { ...(style === null || style === void 0 ? void 0 : style.typography), + fontStyle: newStyles.fontStyle, + fontWeight: newStyles.fontWeight + } + }) + }); + }; + + const fontStyle = style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.fontStyle; + const fontWeight = style === null || style === void 0 ? void 0 : (_style$typography2 = style.typography) === null || _style$typography2 === void 0 ? void 0 : _style$typography2.fontWeight; + return (0,external_wp_element_namespaceObject.createElement)(FontAppearanceControl, { + onChange: onChange, + hasFontStyles: hasFontStyles, + hasFontWeights: hasFontWeights, + value: { + fontStyle, + fontWeight + } + }); +} +/** + * Checks if font style support has been disabled either by not opting in for + * support or by failing to provide preset styles. + * + * @param {Object} props Block properties. + * @param {string} props.name Name for the block type. + * + * @return {boolean} Whether font style support has been disabled. + */ + +function useIsFontStyleDisabled() { + let { + name: blockName + } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + const styleSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, FONT_STYLE_SUPPORT_KEY); + const hasFontStyles = useSetting('typography.fontStyle'); + return !styleSupport || !hasFontStyles; +} +/** + * Checks if font weight support has been disabled either by not opting in for + * support or by failing to provide preset weights. + * + * @param {Object} props Block properties. + * @param {string} props.name Name for the block type. + * + * @return {boolean} Whether font weight support has been disabled. + */ + +function useIsFontWeightDisabled() { + let { + name: blockName + } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + const weightSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, FONT_WEIGHT_SUPPORT_KEY); + const hasFontWeights = useSetting('typography.fontWeight'); + return !weightSupport || !hasFontWeights; +} +/** + * Checks if font appearance support has been disabled. + * + * @param {Object} props Block properties. + * + * @return {boolean} Whether font appearance support has been disabled. + */ + +function useIsFontAppearanceDisabled(props) { + const stylesDisabled = useIsFontStyleDisabled(props); + const weightsDisabled = useIsFontWeightDisabled(props); + return stylesDisabled && weightsDisabled; +} +/** + * Checks if there is either a font style or weight value set within the + * typography styles. + * + * @param {Object} props Block props. + * @return {boolean} Whether or not the block has a font style or weight. + */ + +function hasFontAppearanceValue(props) { + var _props$attributes$sty; + + const { + fontStyle, + fontWeight + } = ((_props$attributes$sty = props.attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : _props$attributes$sty.typography) || {}; + return !!fontStyle || !!fontWeight; +} +/** + * Resets the font style and weight block support attributes. This can be used + * when disabling the font appearance support controls for a block via a + * progressive discovery panel. + * + * @param {Object} props Block props. + * @param {Object} props.attributes Block's attributes. + * @param {Object} props.setAttributes Function to set block's attributes. + */ + +function resetFontAppearance(_ref) { + let { + attributes = {}, + setAttributes + } = _ref; + const { + style + } = attributes; + setAttributes({ + style: cleanEmptyObject({ ...style, + typography: { ...(style === null || style === void 0 ? void 0 : style.typography), + fontStyle: undefined, + fontWeight: undefined + } + }) + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-family/index.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + +function FontFamilyControl(_ref) { + let { + value = '', + onChange, + fontFamilies, + ...props + } = _ref; + const blockLevelFontFamilies = useSetting('typography.fontFamilies'); + + if (!fontFamilies) { + fontFamilies = blockLevelFontFamilies; + } + + if ((0,external_lodash_namespaceObject.isEmpty)(fontFamilies)) { + return null; + } + + const options = [{ + value: '', + label: (0,external_wp_i18n_namespaceObject.__)('Default') + }, ...fontFamilies.map(_ref2 => { + let { + fontFamily, + name + } = _ref2; + return { + value: fontFamily, + label: name || fontFamily + }; + })]; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, _extends({ + label: (0,external_wp_i18n_namespaceObject.__)('Font family'), + options: options, + value: value, + onChange: onChange, + labelPosition: "top" + }, props)); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/font-family.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + + +const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily'; +/** + * Filters registered block settings, extending attributes to include + * the `fontFamily` attribute. + * + * @param {Object} settings Original block settings + * @return {Object} Filtered block settings + */ + +function font_family_addAttributes(settings) { + if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, FONT_FAMILY_SUPPORT_KEY)) { + return settings; + } // Allow blocks to specify a default value if needed. + + + if (!settings.attributes.fontFamily) { + Object.assign(settings.attributes, { + fontFamily: { + type: 'string' + } + }); + } + + return settings; +} +/** + * Override props assigned to save component to inject font family. + * + * @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 font_family_addSaveProps(props, blockType, attributes) { + if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, FONT_FAMILY_SUPPORT_KEY)) { + return props; + } + + if (shouldSkipSerialization(blockType, TYPOGRAPHY_SUPPORT_KEY, 'fontFamily')) { + return props; + } + + if (!(attributes !== null && attributes !== void 0 && attributes.fontFamily)) { + return props; + } // Use TokenList to dedupe classes. + + + const classes = new (external_wp_tokenList_default())(props.className); + classes.add(`has-${(0,external_lodash_namespaceObject.kebabCase)(attributes === null || attributes === void 0 ? void 0 : attributes.fontFamily)}-font-family`); + const newClassName = classes.value; + props.className = newClassName ? newClassName : undefined; + return props; +} +/** + * Filters registered block settings to expand the block edit wrapper + * by applying the desired styles and classnames. + * + * @param {Object} settings Original block settings. + * + * @return {Object} Filtered block settings. + */ + + +function font_family_addEditProps(settings) { + if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, FONT_FAMILY_SUPPORT_KEY)) { + return settings; + } + + const existingGetEditWrapperProps = settings.getEditWrapperProps; + + settings.getEditWrapperProps = attributes => { + let props = {}; + + if (existingGetEditWrapperProps) { + props = existingGetEditWrapperProps(attributes); + } + + return font_family_addSaveProps(props, settings, attributes); + }; + + return settings; +} + +function FontFamilyEdit(_ref) { + var _find; + + let { + setAttributes, + attributes: { + fontFamily + } + } = _ref; + const fontFamilies = useSetting('typography.fontFamilies'); + const value = (_find = (0,external_lodash_namespaceObject.find)(fontFamilies, _ref2 => { + let { + slug + } = _ref2; + return fontFamily === slug; + })) === null || _find === void 0 ? void 0 : _find.fontFamily; + + function onChange(newValue) { + const predefinedFontFamily = (0,external_lodash_namespaceObject.find)(fontFamilies, _ref3 => { + let { + fontFamily: f + } = _ref3; + return f === newValue; + }); + setAttributes({ + fontFamily: predefinedFontFamily === null || predefinedFontFamily === void 0 ? void 0 : predefinedFontFamily.slug + }); + } + + return (0,external_wp_element_namespaceObject.createElement)(FontFamilyControl, { + className: "block-editor-hooks-font-family-control", + fontFamilies: fontFamilies, + value: value, + onChange: onChange + }); +} +/** + * Custom hook that checks if font-family functionality is disabled. + * + * @param {string} name The name of the block. + * @return {boolean} Whether setting is disabled. + */ + +function useIsFontFamilyDisabled(_ref4) { + let { + name + } = _ref4; + const fontFamilies = useSetting('typography.fontFamilies'); + return !fontFamilies || fontFamilies.length === 0 || !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FONT_FAMILY_SUPPORT_KEY); +} +/** + * Checks if there is a current value set for the font family block support. + * + * @param {Object} props Block props. + * @return {boolean} Whether or not the block has a font family value set. + */ + +function hasFontFamilyValue(props) { + return !!props.attributes.fontFamily; +} +/** + * Resets the font family block support attribute. This can be used when + * disabling the font family support controls for a block via a progressive + * discovery panel. + * + * @param {Object} props Block props. + * @param {Object} props.setAttributes Function to set block's attributes. + */ + +function resetFontFamily(_ref5) { + let { + setAttributes + } = _ref5; + setAttributes({ + fontFamily: undefined + }); +} +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/fontFamily/addAttribute', font_family_addAttributes); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/fontFamily/addSaveProps', font_family_addSaveProps); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/fontFamily/addEditProps', font_family_addEditProps); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-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 {?Object} 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. + */ + +const getFontSize = (fontSizes, fontSizeAttribute, customFontSizeAttribute) => { + if (fontSizeAttribute) { + const fontSizeObject = (0,external_lodash_namespaceObject.find)(fontSizes, { + slug: fontSizeAttribute + }); + + if (fontSizeObject) { + return fontSizeObject; + } + } + + return { + size: customFontSizeAttribute + }; +}; +/** + * Returns the corresponding font size object for a given value. + * + * @param {Array} fontSizes Array of font size objects. + * @param {number} value Font size value. + * + * @return {Object} Font size object. + */ + +function getFontSizeObjectByValue(fontSizes, value) { + const fontSizeObject = (0,external_lodash_namespaceObject.find)(fontSizes, { + size: value + }); + + if (fontSizeObject) { + return fontSizeObject; + } + + return { + size: value + }; +} +/** + * 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-${(0,external_lodash_namespaceObject.kebabCase)(fontSizeSlug)}-font-size`; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/font-size-picker.js + + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + +function FontSizePicker(props) { + const fontSizes = useSetting('typography.fontSizes'); + const disableCustomFontSizes = !useSetting('typography.customFontSize'); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FontSizePicker, _extends({}, props, { + fontSizes: fontSizes, + disableCustomFontSizes: disableCustomFontSizes + })); +} +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/font-sizes/README.md + */ + + +/* harmony default export */ var font_size_picker = (FontSizePicker); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/font-size.js + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + + +const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize'; +/** + * Filters registered block settings, extending attributes to include + * `fontSize` and `fontWeight` attributes. + * + * @param {Object} settings Original block settings. + * + * @return {Object} Filtered block settings. + */ + +function font_size_addAttributes(settings) { + if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, FONT_SIZE_SUPPORT_KEY)) { + return settings; + } // Allow blocks to specify a default value if needed. + + + if (!settings.attributes.fontSize) { + Object.assign(settings.attributes, { + fontSize: { + type: 'string' + } + }); + } + + return settings; +} +/** + * Override props assigned to save component to inject font size. + * + * @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 font_size_addSaveProps(props, blockType, attributes) { + if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, FONT_SIZE_SUPPORT_KEY)) { + return props; + } + + if (shouldSkipSerialization(blockType, TYPOGRAPHY_SUPPORT_KEY, 'fontSize')) { + return props; + } // Use TokenList to dedupe classes. + + + const classes = new (external_wp_tokenList_default())(props.className); + classes.add(getFontSizeClass(attributes.fontSize)); + const newClassName = classes.value; + props.className = newClassName ? newClassName : undefined; + return props; +} +/** + * Filters registered block settings to expand the block edit wrapper + * by applying the desired styles and classnames. + * + * @param {Object} settings Original block settings. + * + * @return {Object} Filtered block settings. + */ + + +function font_size_addEditProps(settings) { + if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, FONT_SIZE_SUPPORT_KEY)) { + return settings; + } + + const existingGetEditWrapperProps = settings.getEditWrapperProps; + + settings.getEditWrapperProps = attributes => { + let props = {}; + + if (existingGetEditWrapperProps) { + props = existingGetEditWrapperProps(attributes); + } + + return font_size_addSaveProps(props, settings, attributes); + }; + + return settings; +} +/** + * Inspector control panel containing the font size related configuration + * + * @param {Object} props + * + * @return {WPElement} Font size edit element. + */ + + +function FontSizeEdit(props) { + var _style$typography, _style$typography2; + + const { + attributes: { + fontSize, + style + }, + setAttributes + } = props; + const fontSizes = useSetting('typography.fontSizes'); + + const onChange = value => { + const fontSizeSlug = getFontSizeObjectByValue(fontSizes, value).slug; + setAttributes({ + style: cleanEmptyObject({ ...style, + typography: { ...(style === null || style === void 0 ? void 0 : style.typography), + fontSize: fontSizeSlug ? undefined : value + } + }), + fontSize: fontSizeSlug + }); + }; + + const fontSizeObject = getFontSize(fontSizes, fontSize, style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.fontSize); + const fontSizeValue = (fontSizeObject === null || fontSizeObject === void 0 ? void 0 : fontSizeObject.size) || (style === null || style === void 0 ? void 0 : (_style$typography2 = style.typography) === null || _style$typography2 === void 0 ? void 0 : _style$typography2.fontSize) || fontSize; + return (0,external_wp_element_namespaceObject.createElement)(font_size_picker, { + onChange: onChange, + value: fontSizeValue, + withReset: false + }); +} +/** + * Checks if there is a current value set for the font size block support. + * + * @param {Object} props Block props. + * @return {boolean} Whether or not the block has a font size value set. + */ + +function hasFontSizeValue(props) { + var _style$typography3; + + const { + fontSize, + style + } = props.attributes; + return !!fontSize || !!(style !== null && style !== void 0 && (_style$typography3 = style.typography) !== null && _style$typography3 !== void 0 && _style$typography3.fontSize); +} +/** + * Resets the font size block support attribute. This can be used when + * disabling the font size support controls for a block via a progressive + * discovery panel. + * + * @param {Object} props Block props. + * @param {Object} props.attributes Block's attributes. + * @param {Object} props.setAttributes Function to set block's attributes. + */ + +function resetFontSize(_ref) { + let { + attributes = {}, + setAttributes + } = _ref; + const { + style + } = attributes; + setAttributes({ + fontSize: undefined, + style: cleanEmptyObject({ ...style, + typography: { ...(style === null || style === void 0 ? void 0 : style.typography), + fontSize: undefined + } + }) + }); +} +/** + * Custom hook that checks if font-size settings have been disabled. + * + * @param {string} name The name of the block. + * @return {boolean} Whether setting is disabled. + */ + +function useIsFontSizeDisabled() { + let { + name: blockName + } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + const fontSizes = useSetting('typography.fontSizes'); + const hasFontSizes = !!(fontSizes !== null && fontSizes !== void 0 && fontSizes.length); + return !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, FONT_SIZE_SUPPORT_KEY) || !hasFontSizes; +} +/** + * Add inline styles for font sizes. + * Ideally, this is not needed and themes load the font-size classes on the + * editor. + * + * @param {Function} BlockListBlock Original component. + * + * @return {Function} Wrapped component. + */ + +const withFontSizeInlineStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockListBlock => props => { + var _style$typography4, _style$typography5; + + const fontSizes = useSetting('typography.fontSizes'); + const { + name: blockName, + attributes: { + fontSize, + style + }, + wrapperProps + } = props; // Only add inline styles if the block supports font sizes, + // doesn't skip serialization of font sizes, + // doesn't already have an inline font size, + // and does have a class to extract the font size from. + + if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, FONT_SIZE_SUPPORT_KEY) || shouldSkipSerialization(blockName, TYPOGRAPHY_SUPPORT_KEY, 'fontSize') || !fontSize || style !== null && style !== void 0 && (_style$typography4 = style.typography) !== null && _style$typography4 !== void 0 && _style$typography4.fontSize) { + return (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, props); + } + + const fontSizeValue = getFontSize(fontSizes, fontSize, style === null || style === void 0 ? void 0 : (_style$typography5 = style.typography) === null || _style$typography5 === void 0 ? void 0 : _style$typography5.fontSize).size; + const newProps = { ...props, + wrapperProps: { ...wrapperProps, + style: { + fontSize: fontSizeValue, + ...(wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.style) + } + } + }; + return (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, newProps); +}, 'withFontSizeInlineStyles'); +const font_size_MIGRATION_PATHS = { + fontSize: [['fontSize'], ['style', 'typography', 'fontSize']] +}; +function font_size_addTransforms(result, source, index, results) { + const destinationBlockType = result.name; + const activeSupports = { + fontSize: (0,external_wp_blocks_namespaceObject.hasBlockSupport)(destinationBlockType, FONT_SIZE_SUPPORT_KEY) + }; + return transformStyles(activeSupports, font_size_MIGRATION_PATHS, result, source, index, results); +} +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/font/addAttribute', font_size_addAttributes); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/font/addSaveProps', font_size_addSaveProps); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/font/addEditProps', font_size_addEditProps); +(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/font-size/with-font-size-inline-styles', withFontSizeInlineStyles); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.switchToBlockType.transformedBlock', 'core/font-size/addTransforms', font_size_addTransforms); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-underline.js + + +/** + * WordPress dependencies + */ + +const formatUnderline = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M7 18v1h10v-1H7zm5-2c1.5 0 2.6-.4 3.4-1.2.8-.8 1.1-2 1.1-3.5V5H15v5.8c0 1.2-.2 2.1-.6 2.8-.4.7-1.2 1-2.4 1s-2-.3-2.4-1c-.4-.7-.6-1.6-.6-2.8V5H7.5v6.2c0 1.5.4 2.7 1.1 3.5.8.9 1.9 1.3 3.4 1.3z" +})); +/* harmony default export */ var format_underline = (formatUnderline); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-strikethrough.js + + +/** + * WordPress dependencies + */ + +const formatStrikethrough = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M9.1 9v-.5c0-.6.2-1.1.7-1.4.5-.3 1.2-.5 2-.5.7 0 1.4.1 2.1.3.7.2 1.4.5 2.1.9l.2-1.9c-.6-.3-1.2-.5-1.9-.7-.8-.1-1.6-.2-2.4-.2-1.5 0-2.7.3-3.6 1-.8.7-1.2 1.5-1.2 2.6V9h2zM20 12H4v1h8.3c.3.1.6.2.8.3.5.2.9.5 1.1.8.3.3.4.7.4 1.2 0 .7-.2 1.1-.8 1.5-.5.3-1.2.5-2.1.5-.8 0-1.6-.1-2.4-.3-.8-.2-1.5-.5-2.2-.8L7 18.1c.5.2 1.2.4 2 .6.8.2 1.6.3 2.4.3 1.7 0 3-.3 3.9-1 .9-.7 1.3-1.6 1.3-2.8 0-.9-.2-1.7-.7-2.2H20v-1z" +})); +/* harmony default export */ var format_strikethrough = (formatStrikethrough); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/text-decoration-control/index.js + + +/** + * WordPress dependencies + */ + + + +const TEXT_DECORATIONS = [{ + name: (0,external_wp_i18n_namespaceObject.__)('Underline'), + value: 'underline', + icon: format_underline +}, { + name: (0,external_wp_i18n_namespaceObject.__)('Strikethrough'), + value: 'line-through', + icon: format_strikethrough +}]; +/** + * Control to facilitate text decoration selections. + * + * @param {Object} props Component props. + * @param {string} props.value Currently selected text decoration. + * @param {Function} props.onChange Handles change in text decoration selection. + * + * @return {WPElement} Text decoration control. + */ + +function TextDecorationControl(_ref) { + let { + value, + onChange + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)("fieldset", { + className: "block-editor-text-decoration-control" + }, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_i18n_namespaceObject.__)('Decoration')), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-text-decoration-control__buttons" + }, TEXT_DECORATIONS.map(textDecoration => { + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + key: textDecoration.value, + icon: textDecoration.icon, + isSmall: true, + isPressed: textDecoration.value === value, + onClick: () => onChange(textDecoration.value === value ? undefined : textDecoration.value), + "aria-label": textDecoration.name + }); + }))); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/text-decoration.js + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + + +/** + * Key within block settings' supports array indicating support for text + * decorations e.g. settings found in `block.json`. + */ + +const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration'; +/** + * Inspector control panel containing the text decoration options. + * + * @param {Object} props Block properties. + * + * @return {WPElement} Text decoration edit element. + */ + +function TextDecorationEdit(props) { + var _style$typography; + + const { + attributes: { + style + }, + setAttributes + } = props; + + function onChange(newDecoration) { + setAttributes({ + style: cleanEmptyObject({ ...style, + typography: { ...(style === null || style === void 0 ? void 0 : style.typography), + textDecoration: newDecoration + } + }) + }); + } + + return (0,external_wp_element_namespaceObject.createElement)(TextDecorationControl, { + value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.textDecoration, + onChange: onChange + }); +} +/** + * Checks if text-decoration settings have been disabled. + * + * @param {string} name Name of the block. + * + * @return {boolean} Whether or not the setting is disabled. + */ + +function useIsTextDecorationDisabled() { + let { + name: blockName + } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + const notSupported = !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, TEXT_DECORATION_SUPPORT_KEY); + const hasTextDecoration = useSetting('typography.textDecoration'); + return notSupported || !hasTextDecoration; +} +/** + * Checks if there is a current value set for the text decoration block support. + * + * @param {Object} props Block props. + * @return {boolean} Whether or not the block has a text decoration set. + */ + +function hasTextDecorationValue(props) { + var _props$attributes$sty, _props$attributes$sty2; + + return !!((_props$attributes$sty = props.attributes.style) !== null && _props$attributes$sty !== void 0 && (_props$attributes$sty2 = _props$attributes$sty.typography) !== null && _props$attributes$sty2 !== void 0 && _props$attributes$sty2.textDecoration); +} +/** + * Resets the text decoration block support attribute. This can be used when + * disabling the text decoration support controls for a block via a progressive + * discovery panel. + * + * @param {Object} props Block props. + * @param {Object} props.attributes Block's attributes. + * @param {Object} props.setAttributes Function to set block's attributes. + */ + +function resetTextDecoration(_ref) { + let { + attributes = {}, + setAttributes + } = _ref; + const { + style + } = attributes; + setAttributes({ + style: cleanEmptyObject({ ...style, + typography: { ...(style === null || style === void 0 ? void 0 : style.typography), + textDecoration: undefined + } + }) + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-uppercase.js + + +/** + * WordPress dependencies + */ + +const formatUppercase = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M6.1 6.8L2.1 18h1.6l1.1-3h4.3l1.1 3h1.6l-4-11.2H6.1zm-.8 6.8L7 8.9l1.7 4.7H5.3zm15.1-.7c-.4-.5-.9-.8-1.6-1 .4-.2.7-.5.8-.9.2-.4.3-.9.3-1.4 0-.9-.3-1.6-.8-2-.6-.5-1.3-.7-2.4-.7h-3.5V18h4.2c1.1 0 2-.3 2.6-.8.6-.6 1-1.4 1-2.4-.1-.8-.3-1.4-.6-1.9zm-5.7-4.7h1.8c.6 0 1.1.1 1.4.4.3.2.5.7.5 1.3 0 .6-.2 1.1-.5 1.3-.3.2-.8.4-1.4.4h-1.8V8.2zm4 8c-.4.3-.9.5-1.5.5h-2.6v-3.8h2.6c1.4 0 2 .6 2 1.9.1.6-.1 1-.5 1.4z" +})); +/* harmony default export */ var format_uppercase = (formatUppercase); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-lowercase.js + + +/** + * WordPress dependencies + */ + +const formatLowercase = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M11 16.8c-.1-.1-.2-.3-.3-.5v-2.6c0-.9-.1-1.7-.3-2.2-.2-.5-.5-.9-.9-1.2-.4-.2-.9-.3-1.6-.3-.5 0-1 .1-1.5.2s-.9.3-1.2.6l.2 1.2c.4-.3.7-.4 1.1-.5.3-.1.7-.2 1-.2.6 0 1 .1 1.3.4.3.2.4.7.4 1.4-1.2 0-2.3.2-3.3.7s-1.4 1.1-1.4 2.1c0 .7.2 1.2.7 1.6.4.4 1 .6 1.8.6.9 0 1.7-.4 2.4-1.2.1.3.2.5.4.7.1.2.3.3.6.4.3.1.6.1 1.1.1h.1l.2-1.2h-.1c-.4.1-.6 0-.7-.1zM9.2 16c-.2.3-.5.6-.9.8-.3.1-.7.2-1.1.2-.4 0-.7-.1-.9-.3-.2-.2-.3-.5-.3-.9 0-.6.2-1 .7-1.3.5-.3 1.3-.4 2.5-.5v2zm10.6-3.9c-.3-.6-.7-1.1-1.2-1.5-.6-.4-1.2-.6-1.9-.6-.5 0-.9.1-1.4.3-.4.2-.8.5-1.1.8V6h-1.4v12h1.3l.2-1c.2.4.6.6 1 .8.4.2.9.3 1.4.3.7 0 1.2-.2 1.8-.5.5-.4 1-.9 1.3-1.5.3-.6.5-1.3.5-2.1-.1-.6-.2-1.3-.5-1.9zm-1.7 4c-.4.5-.9.8-1.6.8s-1.2-.2-1.7-.7c-.4-.5-.7-1.2-.7-2.1 0-.9.2-1.6.7-2.1.4-.5 1-.7 1.7-.7s1.2.3 1.6.8c.4.5.6 1.2.6 2s-.2 1.4-.6 2z" +})); +/* harmony default export */ var format_lowercase = (formatLowercase); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-capitalize.js + + +/** + * WordPress dependencies + */ + +const formatCapitalize = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M7.1 6.8L3.1 18h1.6l1.1-3h4.3l1.1 3h1.6l-4-11.2H7.1zm-.8 6.8L8 8.9l1.7 4.7H6.3zm14.5-1.5c-.3-.6-.7-1.1-1.2-1.5-.6-.4-1.2-.6-1.9-.6-.5 0-.9.1-1.4.3-.4.2-.8.5-1.1.8V6h-1.4v12h1.3l.2-1c.2.4.6.6 1 .8.4.2.9.3 1.4.3.7 0 1.2-.2 1.8-.5.5-.4 1-.9 1.3-1.5.3-.6.5-1.3.5-2.1-.1-.6-.2-1.3-.5-1.9zm-1.7 4c-.4.5-.9.8-1.6.8s-1.2-.2-1.7-.7c-.4-.5-.7-1.2-.7-2.1 0-.9.2-1.6.7-2.1.4-.5 1-.7 1.7-.7s1.2.3 1.6.8c.4.5.6 1.2.6 2 .1.8-.2 1.4-.6 2z" +})); +/* harmony default export */ var format_capitalize = (formatCapitalize); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/text-transform-control/index.js + + +/** + * WordPress dependencies + */ + + + +const TEXT_TRANSFORMS = [{ + name: (0,external_wp_i18n_namespaceObject.__)('Uppercase'), + value: 'uppercase', + icon: format_uppercase +}, { + name: (0,external_wp_i18n_namespaceObject.__)('Lowercase'), + value: 'lowercase', + icon: format_lowercase +}, { + name: (0,external_wp_i18n_namespaceObject.__)('Capitalize'), + value: 'capitalize', + icon: format_capitalize +}]; +/** + * Control to facilitate text transform selections. + * + * @param {Object} props Component props. + * @param {string} props.value Currently selected text transform. + * @param {Function} props.onChange Handles change in text transform selection. + * + * @return {WPElement} Text transform control. + */ + +function TextTransformControl(_ref) { + let { + value, + onChange + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)("fieldset", { + className: "block-editor-text-transform-control" + }, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_i18n_namespaceObject.__)('Letter case')), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-text-transform-control__buttons" + }, TEXT_TRANSFORMS.map(textTransform => { + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + key: textTransform.value, + icon: textTransform.icon, + isSmall: true, + isPressed: value === textTransform.value, + "aria-label": textTransform.name, + onClick: () => onChange(value === textTransform.value ? undefined : textTransform.value) + }); + }))); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/text-transform.js + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + + +/** + * Key within block settings' supports array indicating support for text + * transforms e.g. settings found in `block.json`. + */ + +const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform'; +/** + * Inspector control panel containing the text transform options. + * + * @param {Object} props Block properties. + * + * @return {WPElement} Text transform edit element. + */ + +function TextTransformEdit(props) { + var _style$typography; + + const { + attributes: { + style + }, + setAttributes + } = props; + + function onChange(newTransform) { + setAttributes({ + style: cleanEmptyObject({ ...style, + typography: { ...(style === null || style === void 0 ? void 0 : style.typography), + textTransform: newTransform + } + }) + }); + } + + return (0,external_wp_element_namespaceObject.createElement)(TextTransformControl, { + value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.textTransform, + onChange: onChange + }); +} +/** + * Checks if text-transform settings have been disabled. + * + * @param {string} name Name of the block. + * + * @return {boolean} Whether or not the setting is disabled. + */ + +function useIsTextTransformDisabled() { + let { + name: blockName + } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + const notSupported = !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, TEXT_TRANSFORM_SUPPORT_KEY); + const hasTextTransforms = useSetting('typography.textTransform'); + return notSupported || !hasTextTransforms; +} +/** + * Checks if there is a current value set for the text transform block support. + * + * @param {Object} props Block props. + * @return {boolean} Whether or not the block has a text transform set. + */ + +function hasTextTransformValue(props) { + var _props$attributes$sty, _props$attributes$sty2; + + return !!((_props$attributes$sty = props.attributes.style) !== null && _props$attributes$sty !== void 0 && (_props$attributes$sty2 = _props$attributes$sty.typography) !== null && _props$attributes$sty2 !== void 0 && _props$attributes$sty2.textTransform); +} +/** + * Resets the text transform block support attribute. This can be used when + * disabling the text transform support controls for a block via a progressive + * discovery panel. + * + * @param {Object} props Block props. + * @param {Object} props.attributes Block's attributes. + * @param {Object} props.setAttributes Function to set block's attributes. + */ + +function resetTextTransform(_ref) { + let { + attributes = {}, + setAttributes + } = _ref; + const { + style + } = attributes; + setAttributes({ + style: cleanEmptyObject({ ...style, + typography: { ...(style === null || style === void 0 ? void 0 : style.typography), + textTransform: undefined + } + }) + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/letter-spacing-control/index.js + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +/** + * Control for letter-spacing. + * + * @param {Object} props Component props. + * @param {string} props.value Currently selected letter-spacing. + * @param {Function} props.onChange Handles change in letter-spacing selection. + * @param {string|number|undefined} props.__unstableInputWidth Input width to pass through to inner UnitControl. Should be a valid CSS value. + * + * @return {WPElement} Letter-spacing control. + */ + +function LetterSpacingControl(_ref) { + let { + value, + onChange, + __unstableInputWidth = '60px' + } = _ref; + const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ + availableUnits: useSetting('spacing.units') || ['px', 'em', 'rem'], + defaultValues: { + px: 2, + em: 0.2, + rem: 0.2 + } + }); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Letter spacing'), + value: value, + __unstableInputWidth: __unstableInputWidth, + units: units, + onChange: onChange + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/letter-spacing.js + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + + +/** + * Key within block settings' supports array indicating support for letter-spacing + * e.g. settings found in `block.json`. + */ + +const LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing'; +/** + * Inspector control panel containing the letter-spacing options. + * + * @param {Object} props Block properties. + * @return {WPElement} Letter-spacing edit element. + */ + +function LetterSpacingEdit(props) { + var _style$typography; + + const { + attributes: { + style + }, + setAttributes + } = props; + + function onChange(newSpacing) { + setAttributes({ + style: cleanEmptyObject({ ...style, + typography: { ...(style === null || style === void 0 ? void 0 : style.typography), + letterSpacing: newSpacing + } + }) + }); + } + + return (0,external_wp_element_namespaceObject.createElement)(LetterSpacingControl, { + value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.letterSpacing, + onChange: onChange, + __unstableInputWidth: '100%' + }); +} +/** + * Checks if letter-spacing settings have been disabled. + * + * @param {string} name Name of the block. + * @return {boolean} Whether or not the setting is disabled. + */ + +function useIsLetterSpacingDisabled() { + let { + name: blockName + } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + const notSupported = !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, LETTER_SPACING_SUPPORT_KEY); + const hasLetterSpacing = useSetting('typography.letterSpacing'); + return notSupported || !hasLetterSpacing; +} +/** + * Checks if there is a current value set for the letter spacing block support. + * + * @param {Object} props Block props. + * @return {boolean} Whether or not the block has a letter spacing set. + */ + +function hasLetterSpacingValue(props) { + var _props$attributes$sty, _props$attributes$sty2; + + return !!((_props$attributes$sty = props.attributes.style) !== null && _props$attributes$sty !== void 0 && (_props$attributes$sty2 = _props$attributes$sty.typography) !== null && _props$attributes$sty2 !== void 0 && _props$attributes$sty2.letterSpacing); +} +/** + * Resets the letter spacing block support attribute. This can be used when + * disabling the letter spacing support controls for a block via a progressive + * discovery panel. + * + * @param {Object} props Block props. + * @param {Object} props.attributes Block's attributes. + * @param {Object} props.setAttributes Function to set block's attributes. + */ + +function resetLetterSpacing(_ref) { + let { + attributes = {}, + setAttributes + } = _ref; + const { + style + } = attributes; + setAttributes({ + style: cleanEmptyObject({ ...style, + typography: { ...(style === null || style === void 0 ? void 0 : style.typography), + letterSpacing: undefined + } + }) + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/typography.js + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + + + + + + + +const TYPOGRAPHY_SUPPORT_KEY = 'typography'; +const TYPOGRAPHY_SUPPORT_KEYS = [LINE_HEIGHT_SUPPORT_KEY, FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, FONT_FAMILY_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY]; +function TypographyPanel(props) { + const { + clientId + } = props; + const isFontFamilyDisabled = useIsFontFamilyDisabled(props); + const isFontSizeDisabled = useIsFontSizeDisabled(props); + const isFontAppearanceDisabled = useIsFontAppearanceDisabled(props); + const isLineHeightDisabled = useIsLineHeightDisabled(props); + const isTextDecorationDisabled = useIsTextDecorationDisabled(props); + const isTextTransformDisabled = useIsTextTransformDisabled(props); + const isLetterSpacingDisabled = useIsLetterSpacingDisabled(props); + const hasFontStyles = !useIsFontStyleDisabled(props); + const hasFontWeights = !useIsFontWeightDisabled(props); + const isDisabled = useIsTypographyDisabled(props); + const isSupported = hasTypographySupport(props.name); + if (isDisabled || !isSupported) return null; + const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(props.name, [TYPOGRAPHY_SUPPORT_KEY, '__experimentalDefaultControls']); + + const createResetAllFilter = attribute => newAttributes => { + var _newAttributes$style; + + return { ...newAttributes, + style: { ...newAttributes.style, + typography: { ...((_newAttributes$style = newAttributes.style) === null || _newAttributes$style === void 0 ? void 0 : _newAttributes$style.typography), + [attribute]: undefined + } + } + }; + }; + + return (0,external_wp_element_namespaceObject.createElement)(inspector_controls, { + __experimentalGroup: "typography" + }, !isFontFamilyDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + hasValue: () => hasFontFamilyValue(props), + label: (0,external_wp_i18n_namespaceObject.__)('Font family'), + onDeselect: () => resetFontFamily(props), + isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.fontFamily, + resetAllFilter: newAttributes => ({ ...newAttributes, + fontFamily: undefined + }), + panelId: clientId + }, (0,external_wp_element_namespaceObject.createElement)(FontFamilyEdit, props)), !isFontSizeDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + hasValue: () => hasFontSizeValue(props), + label: (0,external_wp_i18n_namespaceObject.__)('Font size'), + onDeselect: () => resetFontSize(props), + isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.fontSize, + resetAllFilter: newAttributes => { + var _newAttributes$style2; + + return { ...newAttributes, + fontSize: undefined, + style: { ...newAttributes.style, + typography: { ...((_newAttributes$style2 = newAttributes.style) === null || _newAttributes$style2 === void 0 ? void 0 : _newAttributes$style2.typography), + fontSize: undefined + } + } + }; + }, + panelId: clientId + }, (0,external_wp_element_namespaceObject.createElement)(FontSizeEdit, props)), !isFontAppearanceDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + className: "single-column", + hasValue: () => hasFontAppearanceValue(props), + label: getFontAppearanceLabel(hasFontStyles, hasFontWeights), + onDeselect: () => resetFontAppearance(props), + isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.fontAppearance, + resetAllFilter: newAttributes => { + var _newAttributes$style3; + + return { ...newAttributes, + style: { ...newAttributes.style, + typography: { ...((_newAttributes$style3 = newAttributes.style) === null || _newAttributes$style3 === void 0 ? void 0 : _newAttributes$style3.typography), + fontStyle: undefined, + fontWeight: undefined + } + } + }; + }, + panelId: clientId + }, (0,external_wp_element_namespaceObject.createElement)(FontAppearanceEdit, props)), !isLineHeightDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + className: "single-column", + hasValue: () => hasLineHeightValue(props), + label: (0,external_wp_i18n_namespaceObject.__)('Line height'), + onDeselect: () => resetLineHeight(props), + isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.lineHeight, + resetAllFilter: createResetAllFilter('lineHeight'), + panelId: clientId + }, (0,external_wp_element_namespaceObject.createElement)(LineHeightEdit, props)), !isTextDecorationDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + className: "single-column", + hasValue: () => hasTextDecorationValue(props), + label: (0,external_wp_i18n_namespaceObject.__)('Decoration'), + onDeselect: () => resetTextDecoration(props), + isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.textDecoration, + resetAllFilter: createResetAllFilter('textDecoration'), + panelId: clientId + }, (0,external_wp_element_namespaceObject.createElement)(TextDecorationEdit, props)), !isTextTransformDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + className: "single-column", + hasValue: () => hasTextTransformValue(props), + label: (0,external_wp_i18n_namespaceObject.__)('Letter case'), + onDeselect: () => resetTextTransform(props), + isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.textTransform, + resetAllFilter: createResetAllFilter('textTransform'), + panelId: clientId + }, (0,external_wp_element_namespaceObject.createElement)(TextTransformEdit, props)), !isLetterSpacingDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + className: "single-column", + hasValue: () => hasLetterSpacingValue(props), + label: (0,external_wp_i18n_namespaceObject.__)('Letter spacing'), + onDeselect: () => resetLetterSpacing(props), + isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.letterSpacing, + resetAllFilter: createResetAllFilter('letterSpacing'), + panelId: clientId + }, (0,external_wp_element_namespaceObject.createElement)(LetterSpacingEdit, props))); +} +const hasTypographySupport = blockName => { + return TYPOGRAPHY_SUPPORT_KEYS.some(key => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, key)); +}; + +function useIsTypographyDisabled() { + let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + const configs = [useIsFontAppearanceDisabled(props), useIsFontSizeDisabled(props), useIsLineHeightDisabled(props), useIsFontFamilyDisabled(props), useIsTextDecorationDisabled(props), useIsTextTransformDisabled(props), useIsLetterSpacingDisabled(props)]; + return configs.filter(Boolean).length === configs.length; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/style.js + + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + + + + + + +const styleSupportKeys = [...TYPOGRAPHY_SUPPORT_KEYS, BORDER_SUPPORT_KEY, COLOR_SUPPORT_KEY, SPACING_SUPPORT_KEY]; + +const hasStyleSupport = blockType => styleSupportKeys.some(key => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, key)); + +const VARIABLE_REFERENCE_PREFIX = 'var:'; +const VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|'; +const VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--'; + +function compileStyleValue(uncompiledValue) { + if ((0,external_lodash_namespaceObject.startsWith)(uncompiledValue, VARIABLE_REFERENCE_PREFIX)) { + const variable = uncompiledValue.slice(VARIABLE_REFERENCE_PREFIX.length).split(VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE).join(VARIABLE_PATH_SEPARATOR_TOKEN_STYLE); + return `var(--wp--${variable})`; + } + + return uncompiledValue; +} +/** + * Returns the inline styles to add depending on the style object + * + * @param {Object} styles Styles configuration. + * + * @return {Object} Flattened CSS variables declaration. + */ + + +function getInlineStyles() { + let styles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + const ignoredStyles = ['spacing.blockGap']; + const output = {}; + Object.keys(external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY).forEach(propKey => { + const path = external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[propKey].value; + const subPaths = external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[propKey].properties; // Ignore styles on elements because they are handled on the server. + + if ((0,external_lodash_namespaceObject.has)(styles, path) && 'elements' !== (0,external_lodash_namespaceObject.first)(path)) { + // Checking if style value is a string allows for shorthand css + // option and backwards compatibility for border radius support. + const styleValue = (0,external_lodash_namespaceObject.get)(styles, path); + + if (!external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[propKey].useEngine) { + if (!!subPaths && !(0,external_lodash_namespaceObject.isString)(styleValue)) { + Object.entries(subPaths).forEach(entry => { + const [name, subPath] = entry; + const value = (0,external_lodash_namespaceObject.get)(styleValue, [subPath]); + + if (value) { + output[name] = compileStyleValue(value); + } + }); + } else if (!ignoredStyles.includes(path.join('.'))) { + output[propKey] = compileStyleValue((0,external_lodash_namespaceObject.get)(styles, path)); + } + } + } + }); // The goal is to move everything to server side generated engine styles + // This is temporary as we absorb more and more styles into the engine. + + const extraRules = getCSSRules(styles, { + selector: 'self' + }); + extraRules.forEach(rule => { + if (rule.selector !== 'self') { + throw "This style can't be added as inline style"; + } + + output[rule.key] = rule.value; + }); + return output; +} + +function compileElementsStyles(selector) { + let elements = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + return (0,external_lodash_namespaceObject.map)(elements, (styles, element) => { + const elementStyles = getInlineStyles(styles); + + if (!(0,external_lodash_namespaceObject.isEmpty)(elementStyles)) { + // The .editor-styles-wrapper selector is required on elements styles. As it is + // added to all other editor styles, not providing it causes reset and global + // styles to override element styles because of higher specificity. + return [`.editor-styles-wrapper .${selector} ${external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[element]}{`, ...(0,external_lodash_namespaceObject.map)(elementStyles, (value, property) => `\t${(0,external_lodash_namespaceObject.kebabCase)(property)}: ${value};`), '}'].join('\n'); + } + + return ''; + }).join('\n'); +} +/** + * Filters registered block settings, extending attributes to include `style` attribute. + * + * @param {Object} settings Original block settings. + * + * @return {Object} Filtered block settings. + */ + + +function style_addAttribute(settings) { + if (!hasStyleSupport(settings)) { + return settings; + } // Allow blocks to specify their own attribute definition with default values if needed. + + + if (!settings.attributes.style) { + Object.assign(settings.attributes, { + style: { + type: 'object' + } + }); + } + + return settings; +} +/** + * A dictionary of paths to flag skipping block support serialization as the key, + * with values providing the style paths to be omitted from serialization. + * + * @constant + * @type {Record} + */ + + +const skipSerializationPathsEdit = { + [`${BORDER_SUPPORT_KEY}.__experimentalSkipSerialization`]: ['border'], + [`${COLOR_SUPPORT_KEY}.__experimentalSkipSerialization`]: [COLOR_SUPPORT_KEY], + [`${TYPOGRAPHY_SUPPORT_KEY}.__experimentalSkipSerialization`]: [TYPOGRAPHY_SUPPORT_KEY], + [`${SPACING_SUPPORT_KEY}.__experimentalSkipSerialization`]: ['spacing'] +}; +/** + * A dictionary of paths to flag skipping block support serialization as the key, + * with values providing the style paths to be omitted from serialization. + * + * Extends the Edit skip paths to enable skipping additional paths in just + * the Save component. This allows a block support to be serialized within the + * editor, while using an alternate approach, such as server-side rendering, when + * the support is saved. + * + * @constant + * @type {Record} + */ + +const skipSerializationPathsSave = { ...skipSerializationPathsEdit, + [`${SPACING_SUPPORT_KEY}`]: ['spacing.blockGap'] +}; +/** + * A dictionary used to normalize feature names between support flags, style + * object properties and __experimentSkipSerialization configuration arrays. + * + * This allows not having to provide a migration for a support flag and possible + * backwards compatibility bridges, while still achieving consistency between + * the support flag and the skip serialization array. + * + * @constant + * @type {Record} + */ + +const renamedFeatures = { + gradients: 'gradient' +}; +/** + * Override props assigned to save component to inject the CSS variables definition. + * + * @param {Object} props Additional props applied to save element. + * @param {Object} blockType Block type. + * @param {Object} attributes Block attributes. + * @param {?Record} skipPaths An object of keys and paths to skip serialization. + * + * @return {Object} Filtered props applied to save element. + */ + +function style_addSaveProps(props, blockType, attributes) { + let skipPaths = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : skipSerializationPathsSave; + + if (!hasStyleSupport(blockType)) { + return props; + } + + let { + style + } = attributes; + (0,external_lodash_namespaceObject.forEach)(skipPaths, (path, indicator) => { + const skipSerialization = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, indicator); + + if (skipSerialization === true) { + style = (0,external_lodash_namespaceObject.omit)(style, path); + } + + if (Array.isArray(skipSerialization)) { + skipSerialization.forEach(featureName => { + const feature = renamedFeatures[featureName] || featureName; + style = (0,external_lodash_namespaceObject.omit)(style, [[...path, feature]]); + }); + } + }); + props.style = { ...getInlineStyles(style), + ...props.style + }; + return props; +} +/** + * Filters registered block settings to extend the block edit wrapper + * to apply the desired styles and classnames properly. + * + * @param {Object} settings Original block settings. + * + * @return {Object}.Filtered block settings. + */ + +function style_addEditProps(settings) { + if (!hasStyleSupport(settings)) { + return settings; + } + + const existingGetEditWrapperProps = settings.getEditWrapperProps; + + settings.getEditWrapperProps = attributes => { + let props = {}; + + if (existingGetEditWrapperProps) { + props = existingGetEditWrapperProps(attributes); + } + + return style_addSaveProps(props, settings, attributes, skipSerializationPathsEdit); + }; + + return settings; +} +/** + * Override the default edit UI to include new inspector controls for + * all the custom styles configs. + * + * @param {Function} BlockEdit Original component. + * + * @return {Function} Wrapped component. + */ + +const withBlockControls = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => { + const shouldDisplayControls = useDisplayBlockControls(); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, shouldDisplayControls && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(ColorEdit, props), (0,external_wp_element_namespaceObject.createElement)(TypographyPanel, props), (0,external_wp_element_namespaceObject.createElement)(BorderPanel, props), (0,external_wp_element_namespaceObject.createElement)(DimensionsPanel, props)), (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props)); +}, 'withToolbarControls'); +/** + * Override the default block element to include duotone styles. + * + * @param {Function} BlockListBlock Original component + * @return {Function} Wrapped component + */ + +const withElementsStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockListBlock => props => { + var _props$attributes$sty, _props$attributes$sty2; + + const blockElementsContainerIdentifier = `wp-elements-${(0,external_wp_compose_namespaceObject.useInstanceId)(BlockListBlock)}`; + const skipLinkColorSerialization = shouldSkipSerialization(props.name, COLOR_SUPPORT_KEY, 'link'); // The Elements API only supports link colors for now, + // hence the specific omission of `link` in the elements styles. + // This might need to be refactored or removed if the Elements API + // changes or `link` supports styles beyond `color`. + + const elements = skipLinkColorSerialization ? (0,external_lodash_namespaceObject.omit)((_props$attributes$sty = props.attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : _props$attributes$sty.elements, ['link']) : (_props$attributes$sty2 = props.attributes.style) === null || _props$attributes$sty2 === void 0 ? void 0 : _props$attributes$sty2.elements; + const styles = compileElementsStyles(blockElementsContainerIdentifier, elements); + const element = (0,external_wp_element_namespaceObject.useContext)(BlockList.__unstableElementContext); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, elements && element && (0,external_wp_element_namespaceObject.createPortal)((0,external_wp_element_namespaceObject.createElement)("style", { + dangerouslySetInnerHTML: { + __html: styles + } + }), element), (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, _extends({}, props, { + className: elements ? classnames_default()(props.className, blockElementsContainerIdentifier) : props.className + }))); +}); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/style/addAttribute', style_addAttribute); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/style/addSaveProps', style_addSaveProps); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/style/addEditProps', style_addEditProps); +(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/style/with-block-controls', withBlockControls); +(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/editor/with-elements-styles', withElementsStyles); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/duotone-control/index.js + + +/** + * WordPress dependencies + */ + + + + +function DuotoneControl(_ref) { + let { + colorPalette, + duotonePalette, + disableCustomColors, + disableCustomDuotone, + value, + onChange + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { + popoverProps: { + className: 'block-editor-duotone-control__popover', + headerTitle: (0,external_wp_i18n_namespaceObject.__)('Duotone'), + isAlternate: true + }, + renderToggle: _ref2 => { + let { + isOpen, + onToggle + } = _ref2; + + const openOnArrowDown = event => { + if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) { + event.preventDefault(); + onToggle(); + } + }; + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + showTooltip: true, + onClick: onToggle, + "aria-haspopup": "true", + "aria-expanded": isOpen, + onKeyDown: openOnArrowDown, + label: (0,external_wp_i18n_namespaceObject.__)('Apply duotone filter'), + icon: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DuotoneSwatch, { + values: value + }) + }); + }, + renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { + label: (0,external_wp_i18n_namespaceObject.__)('Duotone') + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-duotone-control__description" + }, (0,external_wp_i18n_namespaceObject.__)('Create a two-tone color effect without losing your original image.')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DuotonePicker, { + colorPalette: colorPalette, + duotonePalette: duotonePalette, + disableCustomColors: disableCustomColors, + disableCustomDuotone: disableCustomDuotone, + value: value, + onChange: onChange + })) + }); +} + +/* harmony default export */ var duotone_control = (DuotoneControl); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/duotone.js + + + +/** + * External dependencies + */ + + + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + +const duotone_EMPTY_ARRAY = []; +k([names]); +/** + * Convert a list of colors to an object of R, G, and B values. + * + * @param {string[]} colors Array of RBG color strings. + * + * @return {Object} R, G, and B values. + */ + +function getValuesFromColors() { + let colors = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + const values = { + r: [], + g: [], + b: [], + a: [] + }; + colors.forEach(color => { + const rgbColor = w(color).toRgb(); + values.r.push(rgbColor.r / 255); + values.g.push(rgbColor.g / 255); + values.b.push(rgbColor.b / 255); + values.a.push(rgbColor.a); + }); + return values; +} +/** + * Values for the SVG `feComponentTransfer`. + * + * @typedef Values {Object} + * @property {number[]} r Red values. + * @property {number[]} g Green values. + * @property {number[]} b Blue values. + * @property {number[]} a Alpha values. + */ + +/** + * Stylesheet for rendering the duotone filter. + * + * @param {Object} props Duotone props. + * @param {string} props.selector Selector to apply the filter to. + * @param {string} props.id Unique id for this duotone filter. + * + * @return {WPElement} Duotone element. + */ + +function DuotoneStylesheet(_ref) { + let { + selector, + id + } = _ref; + const css = ` +${selector} { + filter: url( #${id} ); +} +`; + return (0,external_wp_element_namespaceObject.createElement)("style", null, css); +} +/** + * SVG for rendering the duotone filter. + * + * @param {Object} props Duotone props. + * @param {string} props.id Unique id for this duotone filter. + * @param {Values} props.values R, G, B, and A values to filter with. + * + * @return {WPElement} Duotone element. + */ + + +function DuotoneFilter(_ref2) { + let { + id, + values + } = _ref2; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, { + xmlnsXlink: "http://www.w3.org/1999/xlink", + viewBox: "0 0 0 0", + width: "0", + height: "0", + focusable: "false", + role: "none", + style: { + visibility: 'hidden', + position: 'absolute', + left: '-9999px', + overflow: 'hidden' + } + }, (0,external_wp_element_namespaceObject.createElement)("defs", null, (0,external_wp_element_namespaceObject.createElement)("filter", { + id: id + }, (0,external_wp_element_namespaceObject.createElement)("feColorMatrix", { + // Use sRGB instead of linearRGB so transparency looks correct. + colorInterpolationFilters: "sRGB", + type: "matrix" // Use perceptual brightness to convert to grayscale. + , + values: " .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 " + }), (0,external_wp_element_namespaceObject.createElement)("feComponentTransfer", { + // Use sRGB instead of linearRGB to be consistent with how CSS gradients work. + colorInterpolationFilters: "sRGB" + }, (0,external_wp_element_namespaceObject.createElement)("feFuncR", { + type: "table", + tableValues: values.r.join(' ') + }), (0,external_wp_element_namespaceObject.createElement)("feFuncG", { + type: "table", + tableValues: values.g.join(' ') + }), (0,external_wp_element_namespaceObject.createElement)("feFuncB", { + type: "table", + tableValues: values.b.join(' ') + }), (0,external_wp_element_namespaceObject.createElement)("feFuncA", { + type: "table", + tableValues: values.a.join(' ') + })), (0,external_wp_element_namespaceObject.createElement)("feComposite", { + // Re-mask the image with the original transparency since the feColorMatrix above loses that information. + in2: "SourceGraphic", + operator: "in" + })))); +} +/** + * SVG and stylesheet needed for rendering the duotone filter. + * + * @param {Object} props Duotone props. + * @param {string} props.selector Selector to apply the filter to. + * @param {string} props.id Unique id for this duotone filter. + * @param {Values} props.values R, G, B, and A values to filter with. + * + * @return {WPElement} Duotone element. + */ + + +function InlineDuotone(_ref3) { + let { + selector, + id, + values + } = _ref3; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(DuotoneFilter, { + id: id, + values: values + }), (0,external_wp_element_namespaceObject.createElement)(DuotoneStylesheet, { + id: id, + selector: selector + })); +} + +function useMultiOriginPresets(_ref4) { + let { + presetSetting, + defaultSetting + } = _ref4; + const disableDefault = !useSetting(defaultSetting); + const userPresets = useSetting(`${presetSetting}.custom`) || duotone_EMPTY_ARRAY; + const themePresets = useSetting(`${presetSetting}.theme`) || duotone_EMPTY_ARRAY; + const defaultPresets = useSetting(`${presetSetting}.default`) || duotone_EMPTY_ARRAY; + return (0,external_wp_element_namespaceObject.useMemo)(() => [...userPresets, ...themePresets, ...(disableDefault ? duotone_EMPTY_ARRAY : defaultPresets)], [disableDefault, userPresets, themePresets, defaultPresets]); +} + +function DuotonePanel(_ref5) { + var _style$color; + + let { + attributes, + setAttributes + } = _ref5; + const style = attributes === null || attributes === void 0 ? void 0 : attributes.style; + const duotone = style === null || style === void 0 ? void 0 : (_style$color = style.color) === null || _style$color === void 0 ? void 0 : _style$color.duotone; + const duotonePalette = useMultiOriginPresets({ + presetSetting: 'color.duotone', + defaultSetting: 'color.defaultDuotone' + }); + const colorPalette = useMultiOriginPresets({ + presetSetting: 'color.palette', + defaultSetting: 'color.defaultPalette' + }); + const disableCustomColors = !useSetting('color.custom'); + const disableCustomDuotone = !useSetting('color.customDuotone') || (colorPalette === null || colorPalette === void 0 ? void 0 : colorPalette.length) === 0 && disableCustomColors; + + if ((duotonePalette === null || duotonePalette === void 0 ? void 0 : duotonePalette.length) === 0 && disableCustomDuotone) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)(block_controls, { + group: "block", + __experimentalShareWithChildBlocks: true + }, (0,external_wp_element_namespaceObject.createElement)(duotone_control, { + duotonePalette: duotonePalette, + colorPalette: colorPalette, + disableCustomDuotone: disableCustomDuotone, + disableCustomColors: disableCustomColors, + value: duotone, + onChange: newDuotone => { + const newStyle = { ...style, + color: { ...(style === null || style === void 0 ? void 0 : style.color), + duotone: newDuotone + } + }; + setAttributes({ + style: newStyle + }); + } + })); +} +/** + * Filters registered block settings, extending attributes to include + * the `duotone` attribute. + * + * @param {Object} settings Original block settings. + * + * @return {Object} Filtered block settings. + */ + + +function addDuotoneAttributes(settings) { + if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'color.__experimentalDuotone')) { + return settings; + } // Allow blocks to specify their own attribute definition with default + // values if needed. + + + if (!settings.attributes.style) { + Object.assign(settings.attributes, { + style: { + type: 'object' + } + }); + } + + return settings; +} +/** + * Override the default edit UI to include toolbar controls for duotone if the + * block supports duotone. + * + * @param {Function} BlockEdit Original component. + * + * @return {Function} Wrapped component. + */ + + +const withDuotoneControls = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => { + const hasDuotoneSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(props.name, 'color.__experimentalDuotone'); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props), hasDuotoneSupport && (0,external_wp_element_namespaceObject.createElement)(DuotonePanel, props)); +}, 'withDuotoneControls'); +/** + * Function that scopes a selector with another one. This works a bit like + * SCSS nesting except the `&` operator isn't supported. + * + * @example + * ```js + * const scope = '.a, .b .c'; + * const selector = '> .x, .y'; + * const merged = scopeSelector( scope, selector ); + * // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y' + * ``` + * + * @param {string} scope Selector to scope to. + * @param {string} selector Original selector. + * + * @return {string} Scoped selector. + */ + +function scopeSelector(scope, selector) { + const scopes = scope.split(','); + const selectors = selector.split(','); + const selectorsScoped = []; + scopes.forEach(outer => { + selectors.forEach(inner => { + selectorsScoped.push(`${outer.trim()} ${inner.trim()}`); + }); + }); + return selectorsScoped.join(', '); +} +/** + * Override the default block element to include duotone styles. + * + * @param {Function} BlockListBlock Original component. + * + * @return {Function} Wrapped component. + */ + + +const withDuotoneStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockListBlock => props => { + var _props$attributes, _props$attributes$sty, _props$attributes$sty2; + + const duotoneSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(props.name, 'color.__experimentalDuotone'); + const values = props === null || props === void 0 ? void 0 : (_props$attributes = props.attributes) === null || _props$attributes === void 0 ? void 0 : (_props$attributes$sty = _props$attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : (_props$attributes$sty2 = _props$attributes$sty.color) === null || _props$attributes$sty2 === void 0 ? void 0 : _props$attributes$sty2.duotone; + + if (!duotoneSupport || !values) { + return (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, props); + } + + const id = `wp-duotone-${(0,external_wp_compose_namespaceObject.useInstanceId)(BlockListBlock)}`; // Extra .editor-styles-wrapper specificity is needed in the editor + // since we're not using inline styles to apply the filter. We need to + // override duotone applied by global styles and theme.json. + + const selectorsGroup = scopeSelector(`.editor-styles-wrapper .${id}`, duotoneSupport); + const className = classnames_default()(props === null || props === void 0 ? void 0 : props.className, id); + const element = (0,external_wp_element_namespaceObject.useContext)(BlockList.__unstableElementContext); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, element && (0,external_wp_element_namespaceObject.createPortal)((0,external_wp_element_namespaceObject.createElement)(InlineDuotone, { + selector: selectorsGroup, + id: id, + values: getValuesFromColors(values) + }), element), (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, _extends({}, props, { + className: className + }))); +}, 'withDuotoneStyles'); +function PresetDuotoneFilter(_ref6) { + let { + preset + } = _ref6; + return (0,external_wp_element_namespaceObject.createElement)(DuotoneFilter, { + id: `wp-duotone-${preset.slug}`, + values: getValuesFromColors(preset.colors) + }); +} +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/duotone/add-attributes', addDuotoneAttributes); +(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/editor/duotone/with-editor-controls', withDuotoneControls); +(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/editor/duotone/with-styles', withDuotoneStyles); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/layout.js + + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + + + + +/** + * Internal dependencies + */ + + + + + + + +const layoutBlockSupportKey = '__experimentalLayout'; +/** + * Generates the utility classnames for the given blocks layout attributes. + * This method was primarily added to reintroduce classnames that were removed + * in the 5.9 release (https://github.com/WordPress/gutenberg/issues/38719), rather + * than providing an extensive list of all possible layout classes. The plan is to + * have the style engine generate a more extensive list of utility classnames which + * will then replace this method. + * + * @param { Array } attributes Array of block attributes. + * + * @return { Array } Array of CSS classname strings. + */ + +function getLayoutClasses(attributes) { + var _attributes$layout, _attributes$layout2, _attributes$layout3; + + const layoutClassnames = []; + + if (!attributes.layout) { + return layoutClassnames; + } + + if (attributes !== null && attributes !== void 0 && (_attributes$layout = attributes.layout) !== null && _attributes$layout !== void 0 && _attributes$layout.orientation) { + layoutClassnames.push(`is-${(0,external_lodash_namespaceObject.kebabCase)(attributes.layout.orientation)}`); + } + + if (attributes !== null && attributes !== void 0 && (_attributes$layout2 = attributes.layout) !== null && _attributes$layout2 !== void 0 && _attributes$layout2.justifyContent) { + layoutClassnames.push(`is-content-justification-${(0,external_lodash_namespaceObject.kebabCase)(attributes.layout.justifyContent)}`); + } + + if (attributes !== null && attributes !== void 0 && (_attributes$layout3 = attributes.layout) !== null && _attributes$layout3 !== void 0 && _attributes$layout3.flexWrap && attributes.layout.flexWrap === 'nowrap') { + layoutClassnames.push('is-nowrap'); + } + + return layoutClassnames; +} + +function LayoutPanel(_ref) { + let { + setAttributes, + attributes, + name: blockName + } = _ref; + const { + layout + } = attributes; + const defaultThemeLayout = useSetting('layout'); + const themeSupportsLayout = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getSettings + } = select(store); + return getSettings().supportsLayout; + }, []); + const layoutBlockSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, layoutBlockSupportKey, {}); + const { + allowSwitching, + allowEditing = true, + allowInheriting = true, + default: defaultBlockLayout + } = layoutBlockSupport; + + if (!allowEditing) { + return null; + } // Only show the inherit toggle if it's supported, + // a default theme layout is set (e.g. one that provides `contentSize` and/or `wideSize` values), + // and that the default / flow layout type is in use, as this is the only one that supports inheritance. + + + const showInheritToggle = !!(allowInheriting && !!defaultThemeLayout && (!(layout !== null && layout !== void 0 && layout.type) || (layout === null || layout === void 0 ? void 0 : layout.type) === 'default' || layout !== null && layout !== void 0 && layout.inherit)); + const usedLayout = layout || defaultBlockLayout || {}; + const { + inherit = false, + type = 'default' + } = usedLayout; + /** + * `themeSupportsLayout` is only relevant to the `default/flow` + * layout and it should not be taken into account when other + * `layout` types are used. + */ + + if (type === 'default' && !themeSupportsLayout) { + return null; + } + + const layoutType = getLayoutType(type); + + const onChangeType = newType => setAttributes({ + layout: { + type: newType + } + }); + + const onChangeLayout = newLayout => setAttributes({ + layout: newLayout + }); + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(inspector_controls, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { + title: (0,external_wp_i18n_namespaceObject.__)('Layout') + }, showInheritToggle && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Inherit default layout'), + checked: !!inherit, + onChange: () => setAttributes({ + layout: { + inherit: !inherit + } + }) + }), !inherit && allowSwitching && (0,external_wp_element_namespaceObject.createElement)(LayoutTypeSwitcher, { + type: type, + onChange: onChangeType + }), !inherit && layoutType && (0,external_wp_element_namespaceObject.createElement)(layoutType.inspectorControls, { + layout: usedLayout, + onChange: onChangeLayout, + layoutBlockSupport: layoutBlockSupport + }))), !inherit && layoutType && (0,external_wp_element_namespaceObject.createElement)(layoutType.toolBarControls, { + layout: usedLayout, + onChange: onChangeLayout, + layoutBlockSupport: layoutBlockSupport + })); +} + +function LayoutTypeSwitcher(_ref2) { + let { + type, + onChange + } = _ref2; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ButtonGroup, null, getLayoutTypes().map(_ref3 => { + let { + name, + label + } = _ref3; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + key: name, + isPressed: type === name, + onClick: () => onChange(name) + }, label); + })); +} +/** + * Filters registered block settings, extending attributes to include `layout`. + * + * @param {Object} settings Original block settings. + * + * @return {Object} Filtered block settings. + */ + + +function layout_addAttribute(settings) { + if ((0,external_lodash_namespaceObject.has)(settings.attributes, ['layout', 'type'])) { + return settings; + } + + if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, layoutBlockSupportKey)) { + settings.attributes = { ...settings.attributes, + layout: { + type: 'object' + } + }; + } + + return settings; +} +/** + * Override the default edit UI to include layout controls + * + * @param {Function} BlockEdit Original component. + * + * @return {Function} Wrapped component. + */ + +const withInspectorControls = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => { + const { + name: blockName + } = props; + const supportLayout = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, layoutBlockSupportKey); + return [supportLayout && (0,external_wp_element_namespaceObject.createElement)(LayoutPanel, _extends({ + key: "layout" + }, props)), (0,external_wp_element_namespaceObject.createElement)(BlockEdit, _extends({ + key: "edit" + }, props))]; +}, 'withInspectorControls'); +/** + * Override the default block element to add the layout styles. + * + * @param {Function} BlockListBlock Original component. + * + * @return {Function} Wrapped component. + */ + +const withLayoutStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockListBlock => props => { + const { + name, + attributes + } = props; + const shouldRenderLayoutStyles = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, layoutBlockSupportKey); + const id = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockListBlock); + const defaultThemeLayout = useSetting('layout') || {}; + const element = (0,external_wp_element_namespaceObject.useContext)(BlockList.__unstableElementContext); + const { + layout + } = attributes; + const { + default: defaultBlockLayout + } = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, layoutBlockSupportKey) || {}; + const usedLayout = layout !== null && layout !== void 0 && layout.inherit ? defaultThemeLayout : layout || defaultBlockLayout || {}; + const layoutClasses = shouldRenderLayoutStyles ? getLayoutClasses(attributes) : null; + const className = classnames_default()(props === null || props === void 0 ? void 0 : props.className, { + [`wp-container-${id}`]: shouldRenderLayoutStyles + }, layoutClasses); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, shouldRenderLayoutStyles && element && (0,external_wp_element_namespaceObject.createPortal)((0,external_wp_element_namespaceObject.createElement)(LayoutStyle, { + blockName: name, + selector: `.wp-container-${id}`, + layout: usedLayout, + style: attributes === null || attributes === void 0 ? void 0 : attributes.style + }), element), (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, _extends({}, props, { + className: className + }))); +}); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/layout/addAttribute', layout_addAttribute); +(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/editor/layout/with-layout-styles', withLayoutStyles); +(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/editor/layout/with-inspector-controls', withInspectorControls); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-border-props.js +/** + * External dependencies + */ + +/** + * Internal dependencies + */ + + + + // This utility is intended to assist where the serialization of the border +// block support is being skipped for a block but the border related CSS classes +// & styles still need to be generated so they can be applied to inner elements. + +const use_border_props_EMPTY_ARRAY = []; +/** + * Provides the CSS class names and inline styles for a block's border support + * attributes. + * + * @param {Object} attributes Block attributes. + * @param {string} attributes.borderColor Selected named border color. + * @param {Object} attributes.style Block's styles attribute. + * + * @return {Object} Border block support derived CSS classes & styles. + */ + +function getBorderClassesAndStyles(_ref) { + var _style$border; + + let { + borderColor, + style + } = _ref; + const borderStyles = (style === null || style === void 0 ? void 0 : style.border) || {}; + const borderClass = getColorClassName('border-color', borderColor); + const className = classnames_default()({ + [borderClass]: !!borderClass, + 'has-border-color': borderColor || (style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.color) + }); + return { + className: className || undefined, + style: getInlineStyles({ + border: borderStyles + }) + }; +} +/** + * Derives the border related props for a block from its border block support + * attributes. + * + * Inline styles are forced for named colors to ensure these selections are + * reflected when themes do not load their color stylesheets in the editor. + * + * @param {Object} attributes Block attributes. + * + * @return {Object} ClassName & style props from border block support. + */ + +function useBorderProps(attributes) { + const colors = useSetting('color.palette') || use_border_props_EMPTY_ARRAY; + const borderProps = getBorderClassesAndStyles(attributes); // Force inline style to apply border color when themes do not load their + // color stylesheets in the editor. + + if (attributes.borderColor) { + const borderColorObject = getColorObjectByAttributeValues(colors, attributes.borderColor); + borderProps.style.borderColor = borderColorObject.color; + } + + return borderProps; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-color-props.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + + + // The code in this file has largely been lifted from the color block support +// hook. +// +// This utility is intended to assist where the serialization of the colors +// block support is being skipped for a block but the color related CSS classes +// & styles still need to be generated so they can be applied to inner elements. + +/** + * Provides the CSS class names and inline styles for a block's color support + * attributes. + * + * @param {Object} attributes Block attributes. + * + * @return {Object} Color block support derived CSS classes & styles. + */ + +function getColorClassesAndStyles(attributes) { + var _style$color, _style$color2, _style$color3, _style$color4, _style$elements, _style$elements$link; + + const { + backgroundColor, + textColor, + gradient, + style + } = attributes; // Collect color CSS classes. + + const backgroundClass = getColorClassName('background-color', backgroundColor); + const textClass = getColorClassName('color', textColor); + + const gradientClass = __experimentalGetGradientClass(gradient); + + const hasGradient = gradientClass || (style === null || style === void 0 ? void 0 : (_style$color = style.color) === null || _style$color === void 0 ? void 0 : _style$color.gradient); // Determine color CSS class name list. + + const className = classnames_default()(textClass, gradientClass, { + // Don't apply the background class if there's a gradient. + [backgroundClass]: !hasGradient && !!backgroundClass, + 'has-text-color': textColor || (style === null || style === void 0 ? void 0 : (_style$color2 = style.color) === null || _style$color2 === void 0 ? void 0 : _style$color2.text), + 'has-background': backgroundColor || (style === null || style === void 0 ? void 0 : (_style$color3 = style.color) === null || _style$color3 === void 0 ? void 0 : _style$color3.background) || gradient || (style === null || style === void 0 ? void 0 : (_style$color4 = style.color) === null || _style$color4 === void 0 ? void 0 : _style$color4.gradient), + 'has-link-color': style === null || style === void 0 ? void 0 : (_style$elements = style.elements) === null || _style$elements === void 0 ? void 0 : (_style$elements$link = _style$elements.link) === null || _style$elements$link === void 0 ? void 0 : _style$elements$link.color + }); // Collect inline styles for colors. + + const colorStyles = (style === null || style === void 0 ? void 0 : style.color) || {}; + const styleProp = getInlineStyles({ + color: colorStyles + }); + return { + className: className || undefined, + style: styleProp + }; +} +const EMPTY_OBJECT = {}; +/** + * Determines the color related props for a block derived from its color block + * support attributes. + * + * Inline styles are forced for named colors to ensure these selections are + * reflected when themes do not load their color stylesheets in the editor. + * + * @param {Object} attributes Block attributes. + * + * @return {Object} ClassName & style props from colors block support. + */ + +function useColorProps(attributes) { + const { + backgroundColor, + textColor, + gradient + } = attributes; // Some color settings have a special handling for deprecated flags in `useSetting`, + // so we can't unwrap them by doing const { ... } = useSetting('color') + // until https://github.com/WordPress/gutenberg/issues/37094 is fixed. + + const userPalette = useSetting('color.palette.custom') || []; + const themePalette = useSetting('color.palette.theme') || []; + const defaultPalette = useSetting('color.palette.default') || []; + const gradientsPerOrigin = useSetting('color.gradients') || EMPTY_OBJECT; + const colors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]); + const gradients = (0,external_wp_element_namespaceObject.useMemo)(() => [...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.custom) || []), ...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.theme) || []), ...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.default) || [])], [gradientsPerOrigin]); + const colorProps = getColorClassesAndStyles(attributes); // Force inline styles to apply colors when themes do not load their color + // stylesheets in the editor. + + if (backgroundColor) { + const backgroundColorObject = getColorObjectByAttributeValues(colors, backgroundColor); + colorProps.style.backgroundColor = backgroundColorObject.color; + } + + if (gradient) { + colorProps.style.background = getGradientValueBySlug(gradients, gradient); + } + + if (textColor) { + const textColorObject = getColorObjectByAttributeValues(colors, textColor); + colorProps.style.color = textColorObject.color; + } + + return colorProps; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-spacing-props.js +/** + * Internal dependencies + */ + // This utility is intended to assist where the serialization of the spacing +// block support is being skipped for a block but the spacing related CSS +// styles still need to be generated so they can be applied to inner elements. + +/** + * Provides the CSS class names and inline styles for a block's spacing support + * attributes. + * + * @param {Object} attributes Block attributes. + * + * @return {Object} Spacing block support derived CSS classes & styles. + */ + +function getSpacingClassesAndStyles(attributes) { + const { + style + } = attributes; // Collect inline styles for spacing. + + const spacingStyles = (style === null || style === void 0 ? void 0 : style.spacing) || {}; + const styleProp = getInlineStyles({ + spacing: spacingStyles + }); + return { + style: styleProp + }; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-cached-truthy.js +/** + * WordPress dependencies + */ + +/** + * Keeps an up-to-date copy of the passed value and returns it. If value becomes falsy, it will return the last truthy copy. + * + * @param {any} value + * @return {any} value + */ + +function useCachedTruthy(value) { + const [cachedValue, setCachedValue] = (0,external_wp_element_namespaceObject.useState)(value); + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (value) { + setCachedValue(value); + } + }, [value]); + return cachedValue; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/index.js +/** + * Internal dependencies + */ + + + + + + + + + + + + + + + + + + + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/with-colors.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + +/** + * Higher order component factory for injecting the `colorsArray` argument as + * the colors prop in the `withCustomColors` HOC. + * + * @param {Array} colorsArray An array of color objects. + * + * @return {Function} The higher order component. + */ + +const withCustomColorPalette = colorsArray => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => props => (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, _extends({}, props, { + colors: colorsArray +})), 'withCustomColorPalette'); +/** + * Higher order component factory for injecting the editor colors as the + * `colors` prop in the `withColors` HOC. + * + * @return {Function} The higher order component. + */ + + +const withEditorColorPalette = () => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => props => { + // Some color settings have a special handling for deprecated flags in `useSetting`, + // so we can't unwrap them by doing const { ... } = useSetting('color') + // until https://github.com/WordPress/gutenberg/issues/37094 is fixed. + const userPalette = useSetting('color.palette.custom'); + const themePalette = useSetting('color.palette.theme'); + const defaultPalette = useSetting('color.palette.default'); + const allColors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]); + return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, _extends({}, props, { + colors: allColors + })); +}, 'withEditorColorPalette'); +/** + * Helper function used with `createHigherOrderComponent` to create + * higher order components for managing color logic. + * + * @param {Array} colorTypes An array of color types (e.g. 'backgroundColor, borderColor). + * @param {Function} withColorPalette A HOC for injecting the 'colors' prop into the WrappedComponent. + * + * @return {WPComponent} The component that can be used as a HOC. + */ + + +function createColorHOC(colorTypes, withColorPalette) { + const colorMap = (0,external_lodash_namespaceObject.reduce)(colorTypes, (colorObject, colorType) => { + return { ...colorObject, + ...((0,external_lodash_namespaceObject.isString)(colorType) ? { + [colorType]: (0,external_lodash_namespaceObject.kebabCase)(colorType) + } : colorType) + }; + }, {}); + return (0,external_wp_compose_namespaceObject.compose)([withColorPalette, WrappedComponent => { + return class extends external_wp_element_namespaceObject.Component { + constructor(props) { + super(props); + this.setters = this.createSetters(); + this.colorUtils = { + getMostReadableColor: this.getMostReadableColor.bind(this) + }; + this.state = {}; + } + + getMostReadableColor(colorValue) { + const { + colors + } = this.props; + return getMostReadableColor(colors, colorValue); + } + + createSetters() { + return (0,external_lodash_namespaceObject.reduce)(colorMap, (settersAccumulator, colorContext, colorAttributeName) => { + const upperFirstColorAttributeName = (0,external_lodash_namespaceObject.upperFirst)(colorAttributeName); + const customColorAttributeName = `custom${upperFirstColorAttributeName}`; + settersAccumulator[`set${upperFirstColorAttributeName}`] = this.createSetColor(colorAttributeName, customColorAttributeName); + return settersAccumulator; + }, {}); + } + + createSetColor(colorAttributeName, customColorAttributeName) { + return colorValue => { + const colorObject = getColorObjectByColorValue(this.props.colors, colorValue); + this.props.setAttributes({ + [colorAttributeName]: colorObject && colorObject.slug ? colorObject.slug : undefined, + [customColorAttributeName]: colorObject && colorObject.slug ? undefined : colorValue + }); + }; + } + + static getDerivedStateFromProps(_ref, previousState) { + let { + attributes, + colors + } = _ref; + return (0,external_lodash_namespaceObject.reduce)(colorMap, (newState, colorContext, colorAttributeName) => { + const colorObject = getColorObjectByAttributeValues(colors, attributes[colorAttributeName], attributes[`custom${(0,external_lodash_namespaceObject.upperFirst)(colorAttributeName)}`]); + const previousColorObject = previousState[colorAttributeName]; + const previousColor = previousColorObject === null || previousColorObject === void 0 ? void 0 : 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] = { ...colorObject, + class: getColorClassName(colorContext, colorObject.slug) + }; + } + + return newState; + }, {}); + } + + render() { + return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, _extends({}, this.props, { + colors: undefined + }, this.state, this.setters, { + colorUtils: this.colorUtils + })); + } + + }; + }]); +} +/** + * A higher-order component factory for creating a 'withCustomColors' HOC, which handles color logic + * for class generation color value, retrieval and color attribute setting. + * + * Use this higher-order component to work with a custom set of colors. + * + * @example + * + * ```jsx + * const CUSTOM_COLORS = [ { name: 'Red', slug: 'red', color: '#ff0000' }, { name: 'Blue', slug: 'blue', color: '#0000ff' } ]; + * const withCustomColors = createCustomColorsHOC( CUSTOM_COLORS ); + * // ... + * export default compose( + * withCustomColors( 'backgroundColor', 'borderColor' ), + * MyColorfulComponent, + * ); + * ``` + * + * @param {Array} colorsArray The array of color objects (name, slug, color, etc... ). + * + * @return {Function} Higher-order component. + */ + + +function createCustomColorsHOC(colorsArray) { + return function () { + const withColorPalette = withCustomColorPalette(colorsArray); + + for (var _len = arguments.length, colorTypes = new Array(_len), _key = 0; _key < _len; _key++) { + colorTypes[_key] = arguments[_key]; + } + + return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(createColorHOC(colorTypes, withColorPalette), 'withCustomColors'); + }; +} +/** + * A higher-order component, which handles color logic for class generation color value, retrieval and color attribute setting. + * + * For use with the default editor/theme color palette. + * + * @example + * + * ```jsx + * export default compose( + * withColors( 'backgroundColor', { textColor: 'color' } ), + * MyColorfulComponent, + * ); + * ``` + * + * @param {...(Object|string)} colorTypes 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. + */ + +function withColors() { + const withColorPalette = withEditorColorPalette(); + + for (var _len2 = arguments.length, colorTypes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + colorTypes[_key2] = arguments[_key2]; + } + + return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(createColorHOC(colorTypes, withColorPalette), 'withColors'); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/index.js + + + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/gradients/index.js + + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/with-font-sizes.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + +const DEFAULT_FONT_SIZES = []; +/** + * Higher-order component, which handles font size logic for class generation, + * font size value retrieval, and font size change handling. + * + * @param {...(Object|string)} fontSizeNames 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. + */ + const fontSizeAttributeNames = (0,external_lodash_namespaceObject.reduce)(fontSizeNames, (fontSizeAttributeNamesAccumulator, fontSizeAttributeName) => { + fontSizeAttributeNamesAccumulator[fontSizeAttributeName] = `custom${(0,external_lodash_namespaceObject.upperFirst)(fontSizeAttributeName)}`; + return fontSizeAttributeNamesAccumulator; + }, {}); + return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => props => { + const fontSizes = useSetting('typography.fontSizes') || DEFAULT_FONT_SIZES; + return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, _extends({}, props, { + fontSizes: fontSizes + })); + }, 'withFontSizes'), WrappedComponent => { + return class extends external_wp_element_namespaceObject.Component { + constructor(props) { + super(props); + this.setters = this.createSetters(); + this.state = {}; + } + + createSetters() { + return (0,external_lodash_namespaceObject.reduce)(fontSizeAttributeNames, (settersAccumulator, customFontSizeAttributeName, fontSizeAttributeName) => { + const upperFirstFontSizeAttributeName = (0,external_lodash_namespaceObject.upperFirst)(fontSizeAttributeName); + settersAccumulator[`set${upperFirstFontSizeAttributeName}`] = this.createSetFontSize(fontSizeAttributeName, customFontSizeAttributeName); + return settersAccumulator; + }, {}); + } + + createSetFontSize(fontSizeAttributeName, customFontSizeAttributeName) { + return fontSizeValue => { + const fontSizeObject = (0,external_lodash_namespaceObject.find)(this.props.fontSizes, { + size: Number(fontSizeValue) + }); + this.props.setAttributes({ + [fontSizeAttributeName]: fontSizeObject && fontSizeObject.slug ? fontSizeObject.slug : undefined, + [customFontSizeAttributeName]: fontSizeObject && fontSizeObject.slug ? undefined : fontSizeValue + }); + }; + } + + static getDerivedStateFromProps(_ref, previousState) { + let { + attributes, + fontSizes + } = _ref; + + const 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 (!(0,external_lodash_namespaceObject.some)(fontSizeAttributeNames, didAttributesChange)) { + return null; + } + + const newState = (0,external_lodash_namespaceObject.reduce)((0,external_lodash_namespaceObject.pickBy)(fontSizeAttributeNames, didAttributesChange), (newStateAccumulator, customFontSizeAttributeName, fontSizeAttributeName) => { + const fontSizeAttributeValue = attributes[fontSizeAttributeName]; + const fontSizeObject = getFontSize(fontSizes, fontSizeAttributeValue, attributes[customFontSizeAttributeName]); + newStateAccumulator[fontSizeAttributeName] = { ...fontSizeObject, + class: getFontSizeClass(fontSizeAttributeValue) + }; + return newStateAccumulator; + }, {}); + return { ...previousState, + ...newState + }; + } + + render() { + return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, _extends({}, this.props, { + fontSizes: undefined + }, this.state, this.setters)); + } + + }; + }]), 'withFontSizes'); +}); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/index.js + + + + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/align-left.js + + +/** + * WordPress dependencies + */ + +const alignLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M4 19.8h8.9v-1.5H4v1.5zm8.9-15.6H4v1.5h8.9V4.2zm-8.9 7v1.5h16v-1.5H4z" +})); +/* harmony default export */ var align_left = (alignLeft); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/align-center.js + + +/** + * WordPress dependencies + */ + +const align_center_alignCenter = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M16.4 4.2H7.6v1.5h8.9V4.2zM4 11.2v1.5h16v-1.5H4zm3.6 8.6h8.9v-1.5H7.6v1.5z" +})); +/* harmony default export */ var align_center = (align_center_alignCenter); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/align-right.js + + +/** + * WordPress dependencies + */ + +const alignRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M11.1 19.8H20v-1.5h-8.9v1.5zm0-15.6v1.5H20V4.2h-8.9zM4 12.8h16v-1.5H4v1.5z" +})); +/* harmony default export */ var align_right = (alignRight); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/ui.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + +const DEFAULT_ALIGNMENT_CONTROLS = [{ + icon: align_left, + title: (0,external_wp_i18n_namespaceObject.__)('Align text left'), + align: 'left' +}, { + icon: align_center, + title: (0,external_wp_i18n_namespaceObject.__)('Align text center'), + align: 'center' +}, { + icon: align_right, + title: (0,external_wp_i18n_namespaceObject.__)('Align text right'), + align: 'right' +}]; +const alignment_control_ui_POPOVER_PROPS = { + position: 'bottom right', + isAlternate: true +}; + +function AlignmentUI(_ref) { + let { + value, + onChange, + alignmentControls = DEFAULT_ALIGNMENT_CONTROLS, + label = (0,external_wp_i18n_namespaceObject.__)('Align'), + describedBy = (0,external_wp_i18n_namespaceObject.__)('Change text alignment'), + isCollapsed = true, + isToolbar + } = _ref; + + function applyOrUnset(align) { + return () => onChange(value === align ? undefined : align); + } + + const activeAlignment = (0,external_lodash_namespaceObject.find)(alignmentControls, control => control.align === value); + + function setIcon() { + if (activeAlignment) return activeAlignment.icon; + return (0,external_wp_i18n_namespaceObject.isRTL)() ? align_right : align_left; + } + + const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu; + const extraProps = isToolbar ? { + isCollapsed + } : {}; + return (0,external_wp_element_namespaceObject.createElement)(UIComponent, _extends({ + icon: setIcon(), + label: label, + toggleProps: { + describedBy + }, + popoverProps: alignment_control_ui_POPOVER_PROPS, + controls: alignmentControls.map(control => { + const { + align + } = control; + const isActive = value === align; + return { ...control, + isActive, + role: isCollapsed ? 'menuitemradio' : undefined, + onClick: applyOrUnset(align) + }; + }) + }, extraProps)); +} + +/* harmony default export */ var alignment_control_ui = (AlignmentUI); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/index.js + + + +/** + * Internal dependencies + */ + + +const AlignmentControl = props => { + return (0,external_wp_element_namespaceObject.createElement)(alignment_control_ui, _extends({}, props, { + isToolbar: false + })); +}; + +const AlignmentToolbar = props => { + return (0,external_wp_element_namespaceObject.createElement)(alignment_control_ui, _extends({}, props, { + isToolbar: true + })); +}; +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/alignment-control/README.md + */ + + + + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/autocompleters/block.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + + +const block_SHOWN_BLOCK_TYPES = 9; +/** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */ + +/** + * Creates a blocks repeater for replacing the current block with a selected block type. + * + * @return {WPCompleter} A blocks completer. + */ + +function createBlockCompleter() { + return { + name: 'blocks', + className: 'block-editor-autocompleters__block', + triggerPrefix: '/', + + useItems(filterValue) { + const { + rootClientId, + selectedBlockName + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getSelectedBlockClientId, + getBlockName, + getBlockInsertionPoint + } = select(store); + const selectedBlockClientId = getSelectedBlockClientId(); + return { + selectedBlockName: selectedBlockClientId ? getBlockName(selectedBlockClientId) : null, + rootClientId: getBlockInsertionPoint().rootClientId + }; + }, []); + const [items, categories, collections] = use_block_types_state(rootClientId, external_lodash_namespaceObject.noop); + const filteredItems = (0,external_wp_element_namespaceObject.useMemo)(() => { + const initialFilteredItems = !!filterValue.trim() ? searchBlockItems(items, categories, collections, filterValue) : (0,external_lodash_namespaceObject.orderBy)(items, ['frecency'], ['desc']); + return initialFilteredItems.filter(item => item.name !== selectedBlockName).slice(0, block_SHOWN_BLOCK_TYPES); + }, [filterValue, selectedBlockName, items, categories, collections]); + const options = (0,external_wp_element_namespaceObject.useMemo)(() => filteredItems.map(blockItem => { + const { + title, + icon, + isDisabled + } = blockItem; + return { + key: `block-${blockItem.id}`, + value: blockItem, + label: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(block_icon, { + key: "icon", + icon: icon, + showColors: true + }), title), + isDisabled + }; + }), [filteredItems]); + return [options]; + }, + + allowContext(before, after) { + return !(/\S/.test(before) || /\S/.test(after)); + }, + + getOptionCompletion(inserterItem) { + const { + name, + initialAttributes, + innerBlocks + } = inserterItem; + return { + action: 'replace', + value: (0,external_wp_blocks_namespaceObject.createBlock)(name, initialAttributes, (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(innerBlocks)) + }; + } + + }; +} +/** + * Creates a blocks repeater for replacing the current block with a selected block type. + * + * @return {WPCompleter} A blocks completer. + */ + + +/* harmony default export */ var autocompleters_block = (createBlockCompleter()); + +;// CONCATENATED MODULE: external ["wp","apiFetch"] +var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; +var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js + + +/** + * WordPress dependencies + */ + +const page = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z" +})); +/* harmony default export */ var library_page = (page); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post.js + + +/** + * WordPress dependencies + */ + +const post = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z" +})); +/* harmony default export */ var library_post = (post); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/autocompleters/link.js + + +/** + * WordPress dependencies + */ + + + +const SHOWN_SUGGESTIONS = 10; +/** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */ + +/** + * Creates a suggestion list for links to posts or pages. + * + * @return {WPCompleter} A links completer. + */ + +function createLinkCompleter() { + return { + name: 'links', + className: 'block-editor-autocompleters__link', + triggerPrefix: '[[', + options: async letters => { + let options = await external_wp_apiFetch_default()({ + path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/search', { + per_page: SHOWN_SUGGESTIONS, + search: letters, + type: 'post', + order_by: 'menu_order' + }) + }); + options = options.filter(option => option.title !== ''); + return options; + }, + + getOptionKeywords(item) { + const expansionWords = item.title.split(/\s+/); + return [...expansionWords]; + }, + + getOptionLabel(item) { + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, { + key: "icon", + icon: item.subtype === 'page' ? library_page : library_post + }), item.title); + }, + + getOptionCompletion(item) { + return (0,external_wp_element_namespaceObject.createElement)("a", { + href: item.url + }, item.title); + } + + }; +} +/** + * Creates a suggestion list for links to posts or pages.. + * + * @return {WPCompleter} A link completer. + */ + + +/* harmony default export */ var autocompleters_link = (createLinkCompleter()); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/autocomplete/index.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + + +/** + * Shared reference to an empty array for cases where it is important to avoid + * returning a new array reference on every invocation. + * + * @type {Array} + */ + +const autocomplete_EMPTY_ARRAY = []; + +function useCompleters(_ref) { + let { + completers = autocomplete_EMPTY_ARRAY + } = _ref; + const { + name + } = useBlockEditContext(); + return (0,external_wp_element_namespaceObject.useMemo)(() => { + let filteredCompleters = completers; + + if (name === (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() || (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, '__experimentalSlashInserter', false)) { + filteredCompleters = filteredCompleters.concat([autocompleters_block, autocompleters_link]); + } + + if ((0,external_wp_hooks_namespaceObject.hasFilter)('editor.Autocomplete.completers')) { + // Provide copies so filters may directly modify them. + if (filteredCompleters === completers) { + filteredCompleters = filteredCompleters.map(external_lodash_namespaceObject.clone); + } + + filteredCompleters = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.Autocomplete.completers', filteredCompleters, name); + } + + return filteredCompleters; + }, [completers, name]); +} + +function useBlockEditorAutocompleteProps(props) { + return (0,external_wp_components_namespaceObject.__unstableUseAutocompleteProps)({ ...props, + completers: useCompleters(props) + }); +} +/** + * Wrap the default Autocomplete component with one that supports a filter hook + * for customizing its list of autocompleters. + * + * @type {import('react').FC} + */ + +function BlockEditorAutocomplete(props) { + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Autocomplete, _extends({}, props, { + completers: useCompleters(props) + })); +} +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/autocomplete/README.md + */ + + +/* harmony default export */ var autocomplete = (BlockEditorAutocomplete); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/fullscreen.js + + +/** + * WordPress dependencies + */ + +const fullscreen = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M4.2 9h1.5V5.8H9V4.2H4.2V9zm14 9.2H15v1.5h4.8V15h-1.5v3.2zM15 4.2v1.5h3.2V9h1.5V4.2H15zM5.8 15H4.2v4.8H9v-1.5H5.8V15z" +})); +/* harmony default export */ var library_fullscreen = (fullscreen); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-full-height-alignment-control/index.js + + +/** + * WordPress dependencies + */ + + + + +function BlockFullHeightAlignmentControl(_ref) { + let { + isActive, + label = (0,external_wp_i18n_namespaceObject.__)('Toggle full height'), + onToggle, + isDisabled + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + isActive: isActive, + icon: library_fullscreen, + label: label, + onClick: () => onToggle(!isActive), + disabled: isDisabled + }); +} + +/* harmony default export */ var block_full_height_alignment_control = (BlockFullHeightAlignmentControl); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-matrix-control/index.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + +function BlockAlignmentMatrixControl(props) { + const { + label = (0,external_wp_i18n_namespaceObject.__)('Change matrix alignment'), + onChange = external_lodash_namespaceObject.noop, + value = 'center', + isDisabled + } = props; + const icon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalAlignmentMatrixControl.Icon, { + value: value + }); + const className = 'block-editor-block-alignment-matrix-control'; + const popoverClassName = `${className}__popover`; + const isAlternate = true; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { + position: "bottom right", + className: className, + popoverProps: { + className: popoverClassName, + isAlternate + }, + renderToggle: _ref => { + let { + onToggle, + isOpen + } = _ref; + + const openOnArrowDown = event => { + if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) { + event.preventDefault(); + onToggle(); + } + }; + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + onClick: onToggle, + "aria-haspopup": "true", + "aria-expanded": isOpen, + onKeyDown: openOnArrowDown, + label: label, + icon: icon, + showTooltip: true, + disabled: isDisabled + }); + }, + renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalAlignmentMatrixControl, { + hasFocusBorder: false, + onChange: onChange, + value: value + }) + }); +} + +/* harmony default export */ var block_alignment_matrix_control = (BlockAlignmentMatrixControl); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js + + +/** + * WordPress dependencies + */ + +const chevronRightSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" +})); +/* harmony default export */ var chevron_right_small = (chevronRightSmall); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-breadcrumb/index.js + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + +/** + * Block breadcrumb component, displaying the hierarchy of the current block selection as a breadcrumb. + * + * @param {Object} props Component props. + * @param {string} props.rootLabelText Translated label for the root element of the breadcrumb trail. + * @return {WPElement} Block Breadcrumb. + */ + +function BlockBreadcrumb(_ref) { + let { + rootLabelText + } = _ref; + const { + selectBlock, + clearSelectedBlock + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const { + clientId, + parents, + hasSelection + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getSelectionStart, + getSelectedBlockClientId, + getBlockParents + } = select(store); + const selectedBlockClientId = getSelectedBlockClientId(); + return { + parents: getBlockParents(selectedBlockClientId), + clientId: selectedBlockClientId, + hasSelection: !!getSelectionStart().clientId }; }, []); + + const rootLabel = rootLabelText || (0,external_wp_i18n_namespaceObject.__)('Document'); + /* + * Disable reason: The `list` ARIA role is redundant but + * Safari+VoiceOver won't announce the list otherwise. + */ + + /* eslint-disable jsx-a11y/no-redundant-roles */ + + + return (0,external_wp_element_namespaceObject.createElement)("ul", { + className: "block-editor-block-breadcrumb", + role: "list", + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Block breadcrumb') + }, (0,external_wp_element_namespaceObject.createElement)("li", { + className: !hasSelection ? 'block-editor-block-breadcrumb__current' : undefined, + "aria-current": !hasSelection ? 'true' : undefined + }, hasSelection && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + className: "block-editor-block-breadcrumb__button", + variant: "tertiary", + onClick: clearSelectedBlock + }, rootLabel), !hasSelection && rootLabel, !!clientId && (0,external_wp_element_namespaceObject.createElement)(build_module_icon, { + icon: chevron_right_small, + className: "block-editor-block-breadcrumb__separator" + })), parents.map(parentClientId => (0,external_wp_element_namespaceObject.createElement)("li", { + key: parentClientId + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + className: "block-editor-block-breadcrumb__button", + variant: "tertiary", + onClick: () => selectBlock(parentClientId) + }, (0,external_wp_element_namespaceObject.createElement)(BlockTitle, { + clientId: parentClientId, + maximumLength: 35 + })), (0,external_wp_element_namespaceObject.createElement)(build_module_icon, { + icon: chevron_right_small, + className: "block-editor-block-breadcrumb__separator" + }))), !!clientId && (0,external_wp_element_namespaceObject.createElement)("li", { + className: "block-editor-block-breadcrumb__current", + "aria-current": "true" + }, (0,external_wp_element_namespaceObject.createElement)(BlockTitle, { + clientId: clientId, + maximumLength: 35 + }))) + /* eslint-enable jsx-a11y/no-redundant-roles */ + ; +} + +/* harmony default export */ var block_breadcrumb = (BlockBreadcrumb); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-content-overlay/index.js + + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +/** + * External dependencies + */ + + +function BlockContentOverlay(_ref) { + let { + clientId, + tagName: TagName = 'div', + wrapperProps, + className + } = _ref; + const baseClassName = 'block-editor-block-content-overlay'; + const [isOverlayActive, setIsOverlayActive] = (0,external_wp_element_namespaceObject.useState)(true); + const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); + const { + isParentSelected, + hasChildSelected, + isDraggingBlocks, + isParentHighlighted + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + isBlockSelected, + hasSelectedInnerBlock, + isDraggingBlocks: _isDraggingBlocks, + isBlockHighlighted + } = select(store); + return { + isParentSelected: isBlockSelected(clientId), + hasChildSelected: hasSelectedInnerBlock(clientId, true), + isDraggingBlocks: _isDraggingBlocks(), + isParentHighlighted: isBlockHighlighted(clientId) + }; + }, [clientId]); + const classes = classnames_default()(baseClassName, wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.className, className, { + 'overlay-active': isOverlayActive, + 'parent-highlighted': isParentHighlighted, + 'is-dragging-blocks': isDraggingBlocks + }); + (0,external_wp_element_namespaceObject.useEffect)(() => { + // Reenable when blocks are not in use. + if (!isParentSelected && !hasChildSelected && !isOverlayActive) { + setIsOverlayActive(true); + } // Disable if parent selected by another means (such as list view). + // We check hover to ensure the overlay click interaction is not taking place. + // Trying to click the overlay will select the parent block via its 'focusin' + // listener on the wrapper, so if the block is selected while hovered we will + // let the mouseup disable the overlay instead. + + + if (isParentSelected && !isHovered && isOverlayActive) { + setIsOverlayActive(false); + } // Ensure overlay is disabled if a child block is selected. + + + if (hasChildSelected && isOverlayActive) { + setIsOverlayActive(false); + } + }, [isParentSelected, hasChildSelected, isOverlayActive, isHovered]); // Disabled because the overlay div doesn't actually have a role or functionality + // as far as the a11y is concerned. We're just catching the first click so that + // the block can be selected without interacting with its contents. + + /* eslint-disable jsx-a11y/no-static-element-interactions */ + + return (0,external_wp_element_namespaceObject.createElement)(TagName, _extends({}, wrapperProps, { + className: classes, + onMouseEnter: () => setIsHovered(true), + onMouseLeave: () => setIsHovered(false), + onMouseUp: isOverlayActive ? () => setIsOverlayActive(false) : undefined + }), wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.children); +} +/* eslint-enable jsx-a11y/no-static-element-interactions */ + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-style-selector/index.js + + +/** + * WordPress dependencies + */ + + + + +const ColorSelectorSVGIcon = () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, { + xmlns: "https://www.w3.org/2000/svg", + viewBox: "0 0 20 20" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, { + d: "M7.434 5l3.18 9.16H8.538l-.692-2.184H4.628l-.705 2.184H2L5.18 5h2.254zm-1.13 1.904h-.115l-1.148 3.593H7.44L6.304 6.904zM14.348 7.006c1.853 0 2.9.876 2.9 2.374v4.78h-1.79v-.914h-.114c-.362.64-1.123 1.022-2.031 1.022-1.346 0-2.292-.826-2.292-2.108 0-1.27.972-2.006 2.71-2.107l1.696-.102V9.38c0-.584-.42-.914-1.18-.914-.667 0-1.112.228-1.264.647h-1.701c.12-1.295 1.307-2.107 3.066-2.107zm1.079 4.1l-1.416.09c-.793.056-1.18.342-1.18.844 0 .52.45.837 1.091.837.857 0 1.505-.545 1.505-1.256v-.515z" +})); +/** + * Color Selector Icon component. + * + * @param {Object} props Component properties. + * @param {Object} props.style Style object. + * @param {string} props.className Class name for component. + * + * @return {*} React Icon component. + */ + + +const ColorSelectorIcon = _ref => { + let { + style, + className + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-library-colors-selector__icon-container" + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: `${className} block-library-colors-selector__state-selection`, + style: style + }, (0,external_wp_element_namespaceObject.createElement)(ColorSelectorSVGIcon, null))); +}; +/** + * Renders the Colors Selector Toolbar with the icon button. + * + * @param {Object} props Component properties. + * @param {Object} props.TextColor Text color component that wraps icon. + * @param {Object} props.BackgroundColor Background color component that wraps icon. + * + * @return {*} React toggle button component. + */ + + +const renderToggleComponent = _ref2 => { + let { + TextColor, + BackgroundColor + } = _ref2; + return _ref3 => { + let { + onToggle, + isOpen + } = _ref3; + + const openOnArrowDown = event => { + if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) { + event.preventDefault(); + onToggle(); + } + }; + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + className: "components-toolbar__control block-library-colors-selector__toggle", + label: (0,external_wp_i18n_namespaceObject.__)('Open Colors Selector'), + onClick: onToggle, + onKeyDown: openOnArrowDown, + icon: (0,external_wp_element_namespaceObject.createElement)(BackgroundColor, null, (0,external_wp_element_namespaceObject.createElement)(TextColor, null, (0,external_wp_element_namespaceObject.createElement)(ColorSelectorIcon, null))) + })); + }; +}; + +const BlockColorsStyleSelector = _ref4 => { + let { + children, + ...other + } = _ref4; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { + position: "bottom right", + className: "block-library-colors-selector", + contentClassName: "block-library-colors-selector__popover", + renderToggle: renderToggleComponent(other), + renderContent: () => children + }); +}; + +/* harmony default export */ var color_style_selector = (BlockColorsStyleSelector); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js + + +/** + * WordPress dependencies + */ + +const listView = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z" +})); +/* harmony default export */ var list_view = (listView); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/leaf.js + + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +const AnimatedTreeGridRow = animated(external_wp_components_namespaceObject.__experimentalTreeGridRow); +function ListViewLeaf(_ref) { + let { + isSelected, + position, + level, + rowCount, + children, + className, + path, + ...props + } = _ref; + const ref = use_moving_animation({ + isSelected, + adjustScrolling: false, + enableAnimation: true, + triggerAnimationOnChange: path + }); + return (0,external_wp_element_namespaceObject.createElement)(AnimatedTreeGridRow, _extends({ + ref: ref, + className: classnames_default()('block-editor-list-view-leaf', className), + level: level, + positionInSet: position, + setSize: rowCount + }, props), children); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/expander.js + + +/** + * WordPress dependencies + */ + +function ListViewExpander(_ref) { + let { + onClick + } = _ref; + return (// Keyboard events are handled by TreeGrid see: components/src/tree-grid/index.js + // + // The expander component is implemented as a pseudo element in the w3 example + // https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html + // + // We've mimicked this by adding an icon with aria-hidden set to true to hide this from the accessibility tree. + // For the current tree grid implementation, please do not try to make this a button. + // + // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions + (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-list-view__expander", + onClick: event => onClick(event, { + forceToggle: true + }), + "aria-hidden": "true" + }, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, { + icon: chevron_right_small + })) + ); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/block-select-button.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + + + + + +function ListViewBlockSelectButton(_ref, ref) { + let { + className, + block: { + clientId + }, + onClick, + onToggleExpanded, + tabIndex, + onFocus, + onDragStart, + onDragEnd, + draggable + } = _ref; + const blockInformation = useBlockDisplayInformation(clientId); + const { + isLocked + } = useBlockLock(clientId); // The `href` attribute triggers the browser's native HTML drag operations. + // When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html. + // We need to clear any HTML drag data to prevent `pasteHandler` from firing + // inside the `useOnBlockDrop` hook. + + const onDragStartHandler = event => { + event.dataTransfer.clearData(); + onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart(event); + }; + + function onKeyDownHandler(event) { + if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER || event.keyCode === external_wp_keycodes_namespaceObject.SPACE) { + onClick(event); + } + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + className: classnames_default()('block-editor-list-view-block-select-button', className), + onClick: onClick, + onKeyDown: onKeyDownHandler, + ref: ref, + tabIndex: tabIndex, + onFocus: onFocus, + onDragStart: onDragStartHandler, + onDragEnd: onDragEnd, + draggable: draggable, + href: `#block-${clientId}`, + "aria-hidden": true + }, (0,external_wp_element_namespaceObject.createElement)(ListViewExpander, { + onClick: onToggleExpanded + }), (0,external_wp_element_namespaceObject.createElement)(block_icon, { + icon: blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon, + showColors: true + }), (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-list-view-block-select-button__title" + }, (0,external_wp_element_namespaceObject.createElement)(BlockTitle, { + clientId: clientId, + maximumLength: 35 + })), (blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.anchor) && (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-list-view-block-select-button__anchor" + }, blockInformation.anchor), isLocked && (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-list-view-block-select-button__lock" + }, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, { + icon: library_lock + })))); +} + +/* harmony default export */ var block_select_button = ((0,external_wp_element_namespaceObject.forwardRef)(ListViewBlockSelectButton)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/block-contents.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + +const ListViewBlockContents = (0,external_wp_element_namespaceObject.forwardRef)((_ref, ref) => { + let { + onClick, + onToggleExpanded, + block, + isSelected, + position, + siblingBlockCount, + level, + isExpanded, + selectedClientIds, + ...props + } = _ref; + const { + clientId + } = block; + const { + blockMovingClientId, + selectedBlockInBlockEditor + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + hasBlockMovingClientId, + getSelectedBlockClientId + } = select(store); + return { + blockMovingClientId: hasBlockMovingClientId(), + selectedBlockInBlockEditor: getSelectedBlockClientId() + }; + }, [clientId]); + const isBlockMoveTarget = blockMovingClientId && selectedBlockInBlockEditor === clientId; + const className = classnames_default()('block-editor-list-view-block-contents', { + 'is-dropping-before': isBlockMoveTarget + }); // Only include all selected blocks if the currently clicked on block + // is one of the selected blocks. This ensures that if a user attempts + // to drag a block that isn't part of the selection, they're still able + // to drag it and rearrange its position. + + const draggableClientIds = selectedClientIds.includes(clientId) ? selectedClientIds : [clientId]; + return (0,external_wp_element_namespaceObject.createElement)(block_draggable, { + clientIds: draggableClientIds + }, _ref2 => { + let { + draggable, + onDragStart, + onDragEnd + } = _ref2; + return (0,external_wp_element_namespaceObject.createElement)(block_select_button, _extends({ + ref: ref, + className: className, + block: block, + onClick: onClick, + onToggleExpanded: onToggleExpanded, + isSelected: isSelected, + position: position, + siblingBlockCount: siblingBlockCount, + level: level, + draggable: draggable, + onDragStart: onDragStart, + onDragEnd: onDragEnd, + isExpanded: isExpanded + }, props)); + }); +}); +/* harmony default export */ var block_contents = (ListViewBlockContents); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/context.js +/** + * WordPress dependencies + */ + +const ListViewContext = (0,external_wp_element_namespaceObject.createContext)({ + __experimentalFeatures: false, + __experimentalPersistentListViewFeatures: false +}); +const useListViewContext = () => (0,external_wp_element_namespaceObject.useContext)(ListViewContext); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/utils.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +const getBlockPositionDescription = (position, siblingCount, level) => (0,external_wp_i18n_namespaceObject.sprintf)( +/* translators: 1: The numerical position of the block. 2: The total number of blocks. 3. The level of nesting for the block. */ +(0,external_wp_i18n_namespaceObject.__)('Block %1$d of %2$d, Level %3$d'), position, siblingCount, level); +/** + * Returns true if the client ID occurs within the block selection or multi-selection, + * or false otherwise. + * + * @param {string} clientId Block client ID. + * @param {string|string[]} selectedBlockClientIds Selected block client ID, or an array of multi-selected blocks client IDs. + * + * @return {boolean} Whether the block is in multi-selection set. + */ + +const isClientIdSelected = (clientId, selectedBlockClientIds) => (0,external_lodash_namespaceObject.isArray)(selectedBlockClientIds) && selectedBlockClientIds.length ? selectedBlockClientIds.indexOf(clientId) !== -1 : selectedBlockClientIds === clientId; +/** + * From a start and end clientId of potentially different nesting levels, + * return the nearest-depth ids that have a common level of depth in the + * nesting hierarchy. For multiple block selection, this ensure that the + * selection is always at the same nesting level, and not split across + * separate levels. + * + * @param {string} startId The first id of a selection. + * @param {string} endId The end id of a selection, usually one that has been clicked on. + * @param {string[]} startParents An array of ancestor ids for the start id, in descending order. + * @param {string[]} endParents An array of ancestor ids for the end id, in descending order. + * @return {Object} An object containing the start and end ids. + */ + +function getCommonDepthClientIds(startId, endId, startParents, endParents) { + const startPath = [...startParents, startId]; + const endPath = [...endParents, endId]; + const depth = Math.min(startPath.length, endPath.length) - 1; + const start = startPath[depth]; + const end = endPath[depth]; + return { + start, + end + }; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/block.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + + +/** + * Internal dependencies + */ + + + + + + + + + + + +function ListViewBlock(_ref) { + let { + block, + isDragged, + isSelected, + isBranchSelected, + selectBlock, + position, + level, + rowCount, + siblingBlockCount, + showBlockMovers, + path, + isExpanded, + selectedClientIds, + preventAnnouncement + } = _ref; + const cellRef = (0,external_wp_element_namespaceObject.useRef)(null); + const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); + const { + clientId + } = block; + const isFirstSelectedBlock = isSelected && selectedClientIds[0] === clientId; + const isLastSelectedBlock = isSelected && selectedClientIds[selectedClientIds.length - 1] === clientId; + const { + toggleBlockHighlight + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const blockInformation = useBlockDisplayInformation(clientId); + const { + isLocked + } = useBlockLock(clientId); + const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewBlock); + const descriptionId = `list-view-block-select-button__${instanceId}`; + const blockPositionDescription = getBlockPositionDescription(position, siblingBlockCount, level); + + let blockAriaLabel = (0,external_wp_i18n_namespaceObject.__)('Link'); + + if (blockInformation) { + blockAriaLabel = isLocked ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The title of the block. This string indicates a link to select the locked block. + (0,external_wp_i18n_namespaceObject.__)('%s link (locked)'), blockInformation.title) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The title of the block. This string indicates a link to select the block. + (0,external_wp_i18n_namespaceObject.__)('%s link'), blockInformation.title); + } + + const settingsAriaLabel = blockInformation ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The title of the block. + (0,external_wp_i18n_namespaceObject.__)('Options for %s block'), blockInformation.title) : (0,external_wp_i18n_namespaceObject.__)('Options'); + const { + __experimentalFeatures: withExperimentalFeatures, + __experimentalPersistentListViewFeatures: withExperimentalPersistentListViewFeatures, + __experimentalHideContainerBlockActions: hideContainerBlockActions, + isTreeGridMounted, + expand, + collapse + } = useListViewContext(); + const hasSiblings = siblingBlockCount > 0; + const hasRenderedMovers = showBlockMovers && hasSiblings; + const moverCellClassName = classnames_default()('block-editor-list-view-block__mover-cell', { + 'is-visible': isHovered || isSelected + }); + const listViewBlockSettingsClassName = classnames_default()('block-editor-list-view-block__menu-cell', { + 'is-visible': isHovered || isFirstSelectedBlock + }); // If ListView has experimental features related to the Persistent List View, + // only focus the selected list item on mount; otherwise the list would always + // try to steal the focus from the editor canvas. + + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (withExperimentalPersistentListViewFeatures && !isTreeGridMounted && isSelected) { + cellRef.current.focus(); + } + }, []); + const highlightBlock = withExperimentalPersistentListViewFeatures ? toggleBlockHighlight : () => {}; + const onMouseEnter = (0,external_wp_element_namespaceObject.useCallback)(() => { + setIsHovered(true); + highlightBlock(clientId, true); + }, [clientId, setIsHovered, highlightBlock]); + const onMouseLeave = (0,external_wp_element_namespaceObject.useCallback)(() => { + setIsHovered(false); + highlightBlock(clientId, false); + }, [clientId, setIsHovered, highlightBlock]); + const selectEditorBlock = (0,external_wp_element_namespaceObject.useCallback)(event => { + selectBlock(event, clientId); + event.preventDefault(); + }, [clientId, selectBlock]); + const updateSelection = (0,external_wp_element_namespaceObject.useCallback)(newClientId => { + selectBlock(undefined, newClientId); + }, [selectBlock]); + const toggleExpanded = (0,external_wp_element_namespaceObject.useCallback)(event => { + // Prevent shift+click from opening link in a new window when toggling. + event.preventDefault(); + event.stopPropagation(); + + if (isExpanded === true) { + collapse(clientId); + } else if (isExpanded === false) { + expand(clientId); + } + }, [clientId, expand, collapse, isExpanded]); + const showBlockActions = withExperimentalFeatures && ( // hide actions for blocks like core/widget-areas + !hideContainerBlockActions || hideContainerBlockActions && level > 1); + const hideBlockActions = withExperimentalFeatures && !showBlockActions; + let colSpan; + + if (hasRenderedMovers) { + colSpan = 2; + } else if (hideBlockActions) { + colSpan = 3; + } + + const classes = classnames_default()({ + 'is-selected': isSelected, + 'is-first-selected': isFirstSelectedBlock, + 'is-last-selected': isLastSelectedBlock, + 'is-branch-selected': withExperimentalPersistentListViewFeatures && isBranchSelected, + 'is-dragging': isDragged, + 'has-single-cell': hideBlockActions + }); // Only include all selected blocks if the currently clicked on block + // is one of the selected blocks. This ensures that if a user attempts + // to alter a block that isn't part of the selection, they're still able + // to do so. + + const dropdownClientIds = selectedClientIds.includes(clientId) ? selectedClientIds : [clientId]; + return (0,external_wp_element_namespaceObject.createElement)(ListViewLeaf, { + className: classes, + onMouseEnter: onMouseEnter, + onMouseLeave: onMouseLeave, + onFocus: onMouseEnter, + onBlur: onMouseLeave, + level: level, + position: position, + rowCount: rowCount, + path: path, + id: `list-view-block-${clientId}`, + "data-block": clientId, + isExpanded: isExpanded, + "aria-selected": !!isSelected + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridCell, { + className: "block-editor-list-view-block__contents-cell", + colSpan: colSpan, + ref: cellRef, + "aria-label": blockAriaLabel, + "aria-selected": !!isSelected, + "aria-expanded": isExpanded, + "aria-describedby": descriptionId + }, _ref2 => { + let { + ref, + tabIndex, + onFocus + } = _ref2; + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-list-view-block__contents-container" + }, (0,external_wp_element_namespaceObject.createElement)(block_contents, { + block: block, + onClick: selectEditorBlock, + onToggleExpanded: toggleExpanded, + isSelected: isSelected, + position: position, + siblingBlockCount: siblingBlockCount, + level: level, + ref: ref, + tabIndex: tabIndex, + onFocus: onFocus, + isExpanded: isExpanded, + selectedClientIds: selectedClientIds, + preventAnnouncement: preventAnnouncement + }), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-list-view-block-select-button__description", + id: descriptionId + }, blockPositionDescription)); + }), hasRenderedMovers && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridCell, { + className: moverCellClassName, + withoutGridItem: true + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridItem, null, _ref3 => { + let { + ref, + tabIndex, + onFocus + } = _ref3; + return (0,external_wp_element_namespaceObject.createElement)(BlockMoverUpButton, { + orientation: "vertical", + clientIds: [clientId], + ref: ref, + tabIndex: tabIndex, + onFocus: onFocus + }); + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridItem, null, _ref4 => { + let { + ref, + tabIndex, + onFocus + } = _ref4; + return (0,external_wp_element_namespaceObject.createElement)(BlockMoverDownButton, { + orientation: "vertical", + clientIds: [clientId], + ref: ref, + tabIndex: tabIndex, + onFocus: onFocus + }); + }))), showBlockActions && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridCell, { + className: listViewBlockSettingsClassName, + "aria-selected": !!isSelected + }, _ref5 => { + let { + ref, + tabIndex, + onFocus + } = _ref5; + return (0,external_wp_element_namespaceObject.createElement)(block_settings_dropdown, { + clientIds: dropdownClientIds, + icon: more_vertical, + label: settingsAriaLabel, + toggleProps: { + ref, + className: 'block-editor-list-view-block__menu', + tabIndex, + onFocus + }, + disableOpenOnArrowDown: true, + __experimentalSelectBlock: updateSelection + }); + })); +} + +/* harmony default export */ var list_view_block = ((0,external_wp_element_namespaceObject.memo)(ListViewBlock)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/branch.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + +/** + * Given a block, returns the total number of blocks in that subtree. This is used to help determine + * the list position of a block. + * + * When a block is collapsed, we do not count their children as part of that total. In the current drag + * implementation dragged blocks and their children are not counted. + * + * @param {Object} block block tree + * @param {Object} expandedState state that notes which branches are collapsed + * @param {Array} draggedClientIds a list of dragged client ids + * @param {boolean} isExpandedByDefault flag to determine the default fallback expanded state. + * @return {number} block count + */ + +function countBlocks(block, expandedState, draggedClientIds, isExpandedByDefault) { + var _expandedState$block$; + + const isDragged = draggedClientIds === null || draggedClientIds === void 0 ? void 0 : draggedClientIds.includes(block.clientId); + + if (isDragged) { + return 0; + } + + const isExpanded = (_expandedState$block$ = expandedState[block.clientId]) !== null && _expandedState$block$ !== void 0 ? _expandedState$block$ : isExpandedByDefault; + + if (isExpanded) { + return 1 + block.innerBlocks.reduce(countReducer(expandedState, draggedClientIds, isExpandedByDefault), 0); + } + + return 1; +} + +const countReducer = (expandedState, draggedClientIds, isExpandedByDefault) => (count, block) => { + var _expandedState$block$2; + + const isDragged = draggedClientIds === null || draggedClientIds === void 0 ? void 0 : draggedClientIds.includes(block.clientId); + + if (isDragged) { + return count; + } + + const isExpanded = (_expandedState$block$2 = expandedState[block.clientId]) !== null && _expandedState$block$2 !== void 0 ? _expandedState$block$2 : isExpandedByDefault; + + if (isExpanded && block.innerBlocks.length > 0) { + return count + countBlocks(block, expandedState, draggedClientIds, isExpandedByDefault); + } + + return count + 1; +}; + +function ListViewBranch(props) { + const { + blocks, + selectBlock, + showBlockMovers, + showNestedBlocks, + selectedClientIds, + level = 1, + path = '', + isBranchSelected = false, + listPosition = 0, + fixedListWindow, + expandNested + } = props; + const { + expandedState, + draggedClientIds, + __experimentalPersistentListViewFeatures + } = useListViewContext(); + const filteredBlocks = (0,external_lodash_namespaceObject.compact)(blocks); + const blockCount = filteredBlocks.length; + let nextPosition = listPosition; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, filteredBlocks.map((block, index) => { + var _expandedState$client; + + const { + clientId, + innerBlocks + } = block; + + if (index > 0) { + nextPosition += countBlocks(filteredBlocks[index - 1], expandedState, draggedClientIds, expandNested); + } + + const usesWindowing = __experimentalPersistentListViewFeatures; + const { + itemInView + } = fixedListWindow; + const blockInView = !usesWindowing || itemInView(nextPosition); + const position = index + 1; + const updatedPath = path.length > 0 ? `${path}_${position}` : `${position}`; + const hasNestedBlocks = showNestedBlocks && !!innerBlocks && !!innerBlocks.length; + const isExpanded = hasNestedBlocks ? (_expandedState$client = expandedState[clientId]) !== null && _expandedState$client !== void 0 ? _expandedState$client : expandNested : undefined; + const isDragged = !!(draggedClientIds !== null && draggedClientIds !== void 0 && draggedClientIds.includes(clientId)); + const showBlock = isDragged || blockInView; // Make updates to the selected or dragged blocks synchronous, + // but asynchronous for any other block. + + const isSelected = isClientIdSelected(clientId, selectedClientIds); + const isSelectedBranch = isBranchSelected || isSelected && hasNestedBlocks; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_data_namespaceObject.AsyncModeProvider, { + key: clientId, + value: !isSelected + }, showBlock && (0,external_wp_element_namespaceObject.createElement)(list_view_block, { + block: block, + selectBlock: selectBlock, + isSelected: isSelected, + isBranchSelected: isSelectedBranch, + isDragged: isDragged, + level: level, + position: position, + rowCount: blockCount, + siblingBlockCount: blockCount, + showBlockMovers: showBlockMovers, + path: updatedPath, + isExpanded: isExpanded, + listPosition: nextPosition, + selectedClientIds: selectedClientIds + }), !showBlock && (0,external_wp_element_namespaceObject.createElement)("tr", null, (0,external_wp_element_namespaceObject.createElement)("td", { + className: "block-editor-list-view-placeholder" + })), hasNestedBlocks && isExpanded && !isDragged && (0,external_wp_element_namespaceObject.createElement)(ListViewBranch, { + blocks: innerBlocks, + selectBlock: selectBlock, + showBlockMovers: showBlockMovers, + showNestedBlocks: showNestedBlocks, + level: level + 1, + path: updatedPath, + listPosition: nextPosition + 1, + fixedListWindow: fixedListWindow, + isBranchSelected: isSelectedBranch, + selectedClientIds: selectedClientIds, + expandNested: expandNested + })); + })); +} + +ListViewBranch.defaultProps = { + selectBlock: () => {} +}; +/* harmony default export */ var branch = ((0,external_wp_element_namespaceObject.memo)(ListViewBranch)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/drop-indicator.js + + +/** + * WordPress dependencies + */ + + +function ListViewDropIndicator(_ref) { + let { + listViewRef, + blockDropTarget + } = _ref; + const { + rootClientId, + clientId, + dropPosition + } = blockDropTarget || {}; + const [rootBlockElement, blockElement] = (0,external_wp_element_namespaceObject.useMemo)(() => { + if (!listViewRef.current) { + return []; + } // The rootClientId will be defined whenever dropping into inner + // block lists, but is undefined when dropping at the root level. + + + const _rootBlockElement = rootClientId ? listViewRef.current.querySelector(`[data-block="${rootClientId}"]`) : undefined; // The clientId represents the sibling block, the dragged block will + // usually be inserted adjacent to it. It will be undefined when + // dropping a block into an empty block list. + + + const _blockElement = clientId ? listViewRef.current.querySelector(`[data-block="${clientId}"]`) : undefined; + + return [_rootBlockElement, _blockElement]; + }, [rootClientId, clientId]); // The targetElement is the element that the drop indicator will appear + // before or after. When dropping into an empty block list, blockElement + // is undefined, so the indicator will appear after the rootBlockElement. + + const targetElement = blockElement || rootBlockElement; + const getDropIndicatorIndent = (0,external_wp_element_namespaceObject.useCallback)(() => { + if (!rootBlockElement) { + return 0; + } // Calculate the indent using the block icon of the root block. + // Using a classname selector here might be flaky and could be + // improved. + + + const targetElementRect = targetElement.getBoundingClientRect(); + const rootBlockIconElement = rootBlockElement.querySelector('.block-editor-block-icon'); + const rootBlockIconRect = rootBlockIconElement.getBoundingClientRect(); + return rootBlockIconRect.right - targetElementRect.left; + }, [rootBlockElement, targetElement]); + const style = (0,external_wp_element_namespaceObject.useMemo)(() => { + if (!targetElement) { + return {}; + } + + const indent = getDropIndicatorIndent(); + return { + width: targetElement.offsetWidth - indent + }; + }, [getDropIndicatorIndent, targetElement]); + const getAnchorRect = (0,external_wp_element_namespaceObject.useCallback)(() => { + if (!targetElement) { + return {}; + } + + const ownerDocument = targetElement.ownerDocument; + const rect = targetElement.getBoundingClientRect(); + const indent = getDropIndicatorIndent(); + const anchorRect = { + left: rect.left + indent, + right: rect.right, + width: 0, + height: rect.height, + ownerDocument + }; + + if (dropPosition === 'top') { + return { ...anchorRect, + top: rect.top, + bottom: rect.top + }; + } + + if (dropPosition === 'bottom' || dropPosition === 'inside') { + return { ...anchorRect, + top: rect.bottom, + bottom: rect.bottom + }; + } + + return {}; + }, [targetElement, dropPosition, getDropIndicatorIndent]); + + if (!targetElement) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, { + noArrow: true, + animate: false, + getAnchorRect: getAnchorRect, + focusOnMount: false, + className: "block-editor-list-view-drop-indicator" + }, (0,external_wp_element_namespaceObject.createElement)("div", { + style: style, + className: "block-editor-list-view-drop-indicator__line" + })); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-block-selection.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + + +/** + * Internal dependencies + */ + + + +function useBlockSelection() { + const { + clearSelectedBlock, + multiSelect, + selectBlock + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const { + getBlockName, + getBlockParents, + getBlockSelectionStart, + getBlockSelectionEnd, + getSelectedBlockClientIds, + hasMultiSelection, + hasSelectedBlock + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const { + getBlockType + } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); + const updateBlockSelection = (0,external_wp_element_namespaceObject.useCallback)(async (event, clientId, destinationClientId) => { + if (!(event !== null && event !== void 0 && event.shiftKey)) { + await clearSelectedBlock(); + selectBlock(clientId); + return; + } // To handle multiple block selection via the `SHIFT` key, prevent + // the browser default behavior of opening the link in a new window. + + + event.preventDefault(); + const isKeyPress = event.type === 'keydown' && (event.keyCode === external_wp_keycodes_namespaceObject.UP || event.keyCode === external_wp_keycodes_namespaceObject.DOWN || event.keyCode === external_wp_keycodes_namespaceObject.HOME || event.keyCode === external_wp_keycodes_namespaceObject.END); // Handle clicking on a block when no blocks are selected, and return early. + + if (!isKeyPress && !hasSelectedBlock() && !hasMultiSelection()) { + selectBlock(clientId, null); + return; + } + + const selectedBlocks = getSelectedBlockClientIds(); + const clientIdWithParents = [...getBlockParents(clientId), clientId]; + + if (isKeyPress && !selectedBlocks.some(blockId => clientIdWithParents.includes(blockId))) { + // Ensure that shift-selecting blocks via the keyboard only + // expands the current selection if focusing over already + // selected blocks. Otherwise, clear the selection so that + // a user can create a new selection entirely by keyboard. + await clearSelectedBlock(); + } + + let startTarget = getBlockSelectionStart(); + let endTarget = clientId; // Handle keyboard behavior for selecting multiple blocks. + + if (isKeyPress) { + if (!hasSelectedBlock() && !hasMultiSelection()) { + // Set the starting point of the selection to the currently + // focused block, if there are no blocks currently selected. + // This ensures that as the selection is expanded or contracted, + // the starting point of the selection is anchored to that block. + startTarget = clientId; + } + + if (destinationClientId) { + // If the user presses UP or DOWN, we want to ensure that the block they're + // moving to is the target for selection, and not the currently focused one. + endTarget = destinationClientId; + } + } + + const startParents = getBlockParents(startTarget); + const endParents = getBlockParents(endTarget); + const { + start, + end + } = getCommonDepthClientIds(startTarget, endTarget, startParents, endParents); + await multiSelect(start, end, null); // Announce deselected block, or number of deselected blocks if + // the total number of blocks deselected is greater than one. + + const updatedSelectedBlocks = getSelectedBlockClientIds(); // If the selection is greater than 1 and the Home or End keys + // were used to generate the selection, then skip announcing the + // deselected blocks. + + if ((event.keyCode === external_wp_keycodes_namespaceObject.HOME || event.keyCode === external_wp_keycodes_namespaceObject.END) && updatedSelectedBlocks.length > 1) { + return; + } + + const selectionDiff = (0,external_lodash_namespaceObject.difference)(selectedBlocks, updatedSelectedBlocks); + let label; + + if (selectionDiff.length === 1) { + var _getBlockType; + + const title = (_getBlockType = getBlockType(getBlockName(selectionDiff[0]))) === null || _getBlockType === void 0 ? void 0 : _getBlockType.title; + + if (title) { + label = (0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %s: block name */ + (0,external_wp_i18n_namespaceObject.__)('%s deselected.'), title); + } + } else if (selectionDiff.length > 1) { + label = (0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %s: number of deselected blocks */ + (0,external_wp_i18n_namespaceObject.__)('%s blocks deselected.'), selectionDiff.length); + } + + if (label) { + (0,external_wp_a11y_namespaceObject.speak)(label); + } + }, [clearSelectedBlock, getBlockName, getBlockType, getBlockParents, getBlockSelectionStart, getBlockSelectionEnd, getSelectedBlockClientIds, hasMultiSelection, hasSelectedBlock, multiSelect, selectBlock]); + return { + updateBlockSelection + }; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-client-ids.js +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + +function useListViewClientIds(blocks) { + return (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getDraggedBlockClientIds, + getSelectedBlockClientIds, + __unstableGetClientIdsTree + } = select(store); + return { + selectedClientIds: getSelectedBlockClientIds(), + draggedClientIds: getDraggedBlockClientIds(), + clientIdsTree: blocks ? blocks : __unstableGetClientIdsTree() + }; + }, [blocks]); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-drop-zone.js +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + +/** @typedef {import('../../utils/math').WPPoint} WPPoint */ + +/** + * The type of a drag event. + * + * @typedef {'default'|'file'|'html'} WPDragEventType + */ + +/** + * An array representing data for blocks in the DOM used by drag and drop. + * + * @typedef {Object} WPListViewDropZoneBlocks + * @property {string} clientId The client id for the block. + * @property {string} rootClientId The root client id for the block. + * @property {number} blockIndex The block's index. + * @property {Element} element The DOM element representing the block. + * @property {number} innerBlockCount The number of inner blocks the block has. + * @property {boolean} isDraggedBlock Whether the block is currently being dragged. + * @property {boolean} canInsertDraggedBlocksAsSibling Whether the dragged block can be a sibling of this block. + * @property {boolean} canInsertDraggedBlocksAsChild Whether the dragged block can be a child of this block. + */ + +/** + * An object containing details of a drop target. + * + * @typedef {Object} WPListViewDropZoneTarget + * @property {string} blockIndex The insertion index. + * @property {string} rootClientId The root client id for the block. + * @property {string|undefined} clientId The client id for the block. + * @property {'top'|'bottom'|'inside'} dropPosition The position relative to the block that the user is dropping to. + * 'inside' refers to nesting as an inner block. + */ + +/** + * Is the point contained by the rectangle. + * + * @param {WPPoint} point The point. + * @param {DOMRect} rect The rectangle. + * + * @return {boolean} True if the point is contained by the rectangle, false otherwise. + */ + +function isPointContainedByRect(point, rect) { + return rect.left <= point.x && rect.right >= point.x && rect.top <= point.y && rect.bottom >= point.y; +} +/** + * Determines whether the user positioning the dragged block to nest as an + * inner block. + * + * Presently this is determined by whether the cursor is on the right hand side + * of the block. + * + * @param {WPPoint} point The point representing the cursor position when dragging. + * @param {DOMRect} rect The rectangle. + */ + + +function isNestingGesture(point, rect) { + const blockCenterX = rect.left + rect.width / 2; + return point.x > blockCenterX; +} // Block navigation is always a vertical list, so only allow dropping +// to the above or below a block. + + +const ALLOWED_DROP_EDGES = ['top', 'bottom']; +/** + * Given blocks data and the cursor position, compute the drop target. + * + * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view. + * @param {WPPoint} position The point representing the cursor position when dragging. + * + * @return {WPListViewDropZoneTarget} An object containing data about the drop target. + */ + +function getListViewDropTarget(blocksData, position) { + let candidateEdge; + let candidateBlockData; + let candidateDistance; + let candidateRect; + + for (const blockData of blocksData) { + if (blockData.isDraggedBlock) { + continue; + } + + const rect = blockData.element.getBoundingClientRect(); + const [distance, edge] = getDistanceToNearestEdge(position, rect, ALLOWED_DROP_EDGES); + const isCursorWithinBlock = isPointContainedByRect(position, rect); + + if (candidateDistance === undefined || distance < candidateDistance || isCursorWithinBlock) { + candidateDistance = distance; + const index = blocksData.indexOf(blockData); + const previousBlockData = blocksData[index - 1]; // If dragging near the top of a block and the preceding block + // is at the same level, use the preceding block as the candidate + // instead, as later it makes determining a nesting drop easier. + + if (edge === 'top' && previousBlockData && previousBlockData.rootClientId === blockData.rootClientId && !previousBlockData.isDraggedBlock) { + candidateBlockData = previousBlockData; + candidateEdge = 'bottom'; + candidateRect = previousBlockData.element.getBoundingClientRect(); + } else { + candidateBlockData = blockData; + candidateEdge = edge; + candidateRect = rect; + } // If the mouse position is within the block, break early + // as the user would intend to drop either before or after + // this block. + // + // This solves an issue where some rows in the list view + // tree overlap slightly due to sub-pixel rendering. + + + if (isCursorWithinBlock) { + break; + } + } + } + + if (!candidateBlockData) { + return; + } + + const isDraggingBelow = candidateEdge === 'bottom'; // If the user is dragging towards the bottom of the block check whether + // they might be trying to nest the block as a child. + // If the block already has inner blocks, this should always be treated + // as nesting since the next block in the tree will be the first child. + + if (isDraggingBelow && candidateBlockData.canInsertDraggedBlocksAsChild && (candidateBlockData.innerBlockCount > 0 || isNestingGesture(position, candidateRect))) { + return { + rootClientId: candidateBlockData.clientId, + blockIndex: 0, + dropPosition: 'inside' + }; + } // If dropping as a sibling, but block cannot be inserted in + // this context, return early. + + + if (!candidateBlockData.canInsertDraggedBlocksAsSibling) { + return; + } + + const offset = isDraggingBelow ? 1 : 0; + return { + rootClientId: candidateBlockData.rootClientId, + clientId: candidateBlockData.clientId, + blockIndex: candidateBlockData.blockIndex + offset, + dropPosition: candidateEdge + }; +} +/** + * A react hook for implementing a drop zone in list view. + * + * @return {WPListViewDropZoneTarget} The drop target. + */ + + +function useListViewDropZone() { + const { + getBlockRootClientId, + getBlockIndex, + getBlockCount, + getDraggedBlockClientIds, + canInsertBlocks + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const [target, setTarget] = (0,external_wp_element_namespaceObject.useState)(); + const { + rootClientId: targetRootClientId, + blockIndex: targetBlockIndex + } = target || {}; + const onBlockDrop = useOnBlockDrop(targetRootClientId, targetBlockIndex); + const draggedBlockClientIds = getDraggedBlockClientIds(); + const throttled = (0,external_wp_compose_namespaceObject.useThrottle)((0,external_wp_element_namespaceObject.useCallback)((event, currentTarget) => { + const position = { + x: event.clientX, + y: event.clientY + }; + const isBlockDrag = !!(draggedBlockClientIds !== null && draggedBlockClientIds !== void 0 && draggedBlockClientIds.length); + const blockElements = Array.from(currentTarget.querySelectorAll('[data-block]')); + const blocksData = blockElements.map(blockElement => { + const clientId = blockElement.dataset.block; + const rootClientId = getBlockRootClientId(clientId); + return { + clientId, + rootClientId, + blockIndex: getBlockIndex(clientId), + element: blockElement, + isDraggedBlock: isBlockDrag ? draggedBlockClientIds.includes(clientId) : false, + innerBlockCount: getBlockCount(clientId), + canInsertDraggedBlocksAsSibling: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, rootClientId) : true, + canInsertDraggedBlocksAsChild: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, clientId) : true + }; + }); + const newTarget = getListViewDropTarget(blocksData, position); + + if (newTarget) { + setTarget(newTarget); + } + }, [draggedBlockClientIds]), 200); + const ref = (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({ + onDrop: onBlockDrop, + + onDragOver(event) { + // `currentTarget` is only available while the event is being + // handled, so get it now and pass it to the thottled function. + // https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget + throttled(event, event.currentTarget); + }, + + onDragEnd() { + throttled.cancel(); + setTarget(null); + } + + }); + return { + ref, + target + }; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-expand-selected-item.js +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +function useListViewExpandSelectedItem(_ref) { + let { + firstSelectedBlockClientId, + setExpandedState + } = _ref; + const [selectedTreeId, setSelectedTreeId] = (0,external_wp_element_namespaceObject.useState)(null); + const { + selectedBlockParentClientIds + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getBlockParents + } = select(store); + return { + selectedBlockParentClientIds: getBlockParents(firstSelectedBlockClientId, false) + }; + }, [firstSelectedBlockClientId]); + const parentClientIds = Array.isArray(selectedBlockParentClientIds) && selectedBlockParentClientIds.length ? selectedBlockParentClientIds : null; // Expand tree when a block is selected. + + (0,external_wp_element_namespaceObject.useEffect)(() => { + // If the selectedTreeId is the same as the selected block, + // it means that the block was selected using the block list tree. + if (selectedTreeId === firstSelectedBlockClientId) { + return; + } // If the selected block has parents, get the top-level parent. + + + if (parentClientIds) { + // If the selected block has parents, + // expand the tree branch. + setExpandedState({ + type: 'expand', + clientIds: selectedBlockParentClientIds + }); + } + }, [firstSelectedBlockClientId]); + return { + setSelectedTreeId + }; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/index.js + + + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + + + + + + + + +const expanded = (state, action) => { + if (Array.isArray(action.clientIds)) { + return { ...state, + ...action.clientIds.reduce((newState, id) => ({ ...newState, + [id]: action.type === 'expand' + }), {}) + }; + } + + return state; +}; + +const BLOCK_LIST_ITEM_HEIGHT = 36; +/** + * Wrap `ListViewRows` with `TreeGrid`. ListViewRows is a + * recursive component (it renders itself), so this ensures TreeGrid is only + * present at the very top of the navigation grid. + * + * @param {Object} props Components props. + * @param {Array} props.blocks Custom subset of block client IDs to be used instead of the default hierarchy. + * @param {boolean} props.showNestedBlocks Flag to enable displaying nested blocks. + * @param {boolean} props.showBlockMovers Flag to enable block movers + * @param {boolean} props.__experimentalFeatures Flag to enable experimental features. + * @param {boolean} props.__experimentalPersistentListViewFeatures Flag to enable features for the Persistent List View experiment. + * @param {boolean} props.__experimentalHideContainerBlockActions Flag to hide actions of top level blocks (like core/widget-area) + * @param {string} props.id Unique identifier for the root list element (primarily for a11y purposes). + * @param {boolean} props.expandNested Flag to determine whether nested levels are expanded by default. + * @param {Object} ref Forwarded ref + */ + +function ListView(_ref, ref) { + let { + blocks, + __experimentalFeatures, + __experimentalPersistentListViewFeatures, + __experimentalHideContainerBlockActions, + showNestedBlocks, + showBlockMovers, + id, + expandNested = false, + ...props + } = _ref; + const { + clientIdsTree, + draggedClientIds, + selectedClientIds + } = useListViewClientIds(blocks); + const { + visibleBlockCount + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getGlobalBlockCount, + getClientIdsOfDescendants + } = select(store); + const draggedBlockCount = (draggedClientIds === null || draggedClientIds === void 0 ? void 0 : draggedClientIds.length) > 0 ? getClientIdsOfDescendants(draggedClientIds).length + 1 : 0; + return { + visibleBlockCount: getGlobalBlockCount() - draggedBlockCount + }; + }, [draggedClientIds]); + const { + updateBlockSelection + } = useBlockSelection(); + const [expandedState, setExpandedState] = (0,external_wp_element_namespaceObject.useReducer)(expanded, {}); + const { + ref: dropZoneRef, + target: blockDropTarget + } = useListViewDropZone(); + const elementRef = (0,external_wp_element_namespaceObject.useRef)(); + const treeGridRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([elementRef, dropZoneRef, ref]); + const isMounted = (0,external_wp_element_namespaceObject.useRef)(false); + const { + setSelectedTreeId + } = useListViewExpandSelectedItem({ + firstSelectedBlockClientId: selectedClientIds[0], + setExpandedState + }); + const selectEditorBlock = (0,external_wp_element_namespaceObject.useCallback)((event, clientId) => { + updateBlockSelection(event, clientId); + setSelectedTreeId(clientId); + }, [setSelectedTreeId, updateBlockSelection]); + (0,external_wp_element_namespaceObject.useEffect)(() => { + isMounted.current = true; + }, []); // List View renders a fixed number of items and relies on each having a fixed item height of 36px. + // If this value changes, we should also change the itemHeight value set in useFixedWindowList. + // See: https://github.com/WordPress/gutenberg/pull/35230 for additional context. + + const [fixedListWindow] = (0,external_wp_compose_namespaceObject.__experimentalUseFixedWindowList)(elementRef, BLOCK_LIST_ITEM_HEIGHT, visibleBlockCount, { + useWindowing: __experimentalPersistentListViewFeatures, + windowOverscan: 40 + }); + const expand = (0,external_wp_element_namespaceObject.useCallback)(clientId => { + if (!clientId) { + return; + } + + setExpandedState({ + type: 'expand', + clientIds: [clientId] + }); + }, [setExpandedState]); + const collapse = (0,external_wp_element_namespaceObject.useCallback)(clientId => { + if (!clientId) { + return; + } + + setExpandedState({ + type: 'collapse', + clientIds: [clientId] + }); + }, [setExpandedState]); + const expandRow = (0,external_wp_element_namespaceObject.useCallback)(row => { + var _row$dataset; + + expand(row === null || row === void 0 ? void 0 : (_row$dataset = row.dataset) === null || _row$dataset === void 0 ? void 0 : _row$dataset.block); + }, [expand]); + const collapseRow = (0,external_wp_element_namespaceObject.useCallback)(row => { + var _row$dataset2; + + collapse(row === null || row === void 0 ? void 0 : (_row$dataset2 = row.dataset) === null || _row$dataset2 === void 0 ? void 0 : _row$dataset2.block); + }, [collapse]); + const focusRow = (0,external_wp_element_namespaceObject.useCallback)((event, startRow, endRow) => { + if (event.shiftKey) { + var _startRow$dataset, _endRow$dataset; + + updateBlockSelection(event, startRow === null || startRow === void 0 ? void 0 : (_startRow$dataset = startRow.dataset) === null || _startRow$dataset === void 0 ? void 0 : _startRow$dataset.block, endRow === null || endRow === void 0 ? void 0 : (_endRow$dataset = endRow.dataset) === null || _endRow$dataset === void 0 ? void 0 : _endRow$dataset.block); + } + }, [updateBlockSelection]); + const contextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ + __experimentalFeatures, + __experimentalPersistentListViewFeatures, + __experimentalHideContainerBlockActions, + isTreeGridMounted: isMounted.current, + draggedClientIds, + expandedState, + expand, + collapse + }), [__experimentalFeatures, __experimentalPersistentListViewFeatures, __experimentalHideContainerBlockActions, isMounted.current, draggedClientIds, expandedState, expand, collapse]); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_data_namespaceObject.AsyncModeProvider, { + value: true + }, (0,external_wp_element_namespaceObject.createElement)(ListViewDropIndicator, { + listViewRef: elementRef, + blockDropTarget: blockDropTarget + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTreeGrid, { + id: id, + className: "block-editor-list-view-tree", + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Block navigation structure'), + ref: treeGridRef, + onCollapseRow: collapseRow, + onExpandRow: expandRow, + onFocusRow: focusRow + }, (0,external_wp_element_namespaceObject.createElement)(ListViewContext.Provider, { + value: contextValue + }, (0,external_wp_element_namespaceObject.createElement)(branch, _extends({ + blocks: clientIdsTree, + selectBlock: selectEditorBlock, + showNestedBlocks: showNestedBlocks, + showBlockMovers: showBlockMovers, + fixedListWindow: fixedListWindow, + selectedClientIds: selectedClientIds, + expandNested: expandNested + }, props))))); +} + +/* harmony default export */ var components_list_view = ((0,external_wp_element_namespaceObject.forwardRef)(ListView)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/dropdown.js + + + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + + +function BlockNavigationDropdownToggle(_ref) { + let { + isEnabled, + onToggle, + isOpen, + innerRef, + ...props + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({}, props, { + ref: innerRef, + icon: list_view, + "aria-expanded": isOpen, + "aria-haspopup": "true", + onClick: isEnabled ? onToggle : undefined + /* translators: button label text should, if possible, be under 16 characters. */ + , + label: (0,external_wp_i18n_namespaceObject.__)('List view'), + className: "block-editor-block-navigation", + "aria-disabled": !isEnabled + })); +} + +function BlockNavigationDropdown(_ref2, ref) { + let { + isDisabled, + __experimentalFeatures, + ...props + } = _ref2; + const hasBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(store).getBlockCount(), []); + const isEnabled = hasBlocks && !isDisabled; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { + contentClassName: "block-editor-block-navigation__popover", + position: "bottom right", + renderToggle: _ref3 => { + let { + isOpen, + onToggle + } = _ref3; + return (0,external_wp_element_namespaceObject.createElement)(BlockNavigationDropdownToggle, _extends({}, props, { + innerRef: ref, + isOpen: isOpen, + onToggle: onToggle, + isEnabled: isEnabled + })); + }, + renderContent: () => (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-navigation__container" + }, (0,external_wp_element_namespaceObject.createElement)("p", { + className: "block-editor-block-navigation__label" + }, (0,external_wp_i18n_namespaceObject.__)('List view')), (0,external_wp_element_namespaceObject.createElement)(components_list_view, { + showNestedBlocks: true, + __experimentalFeatures: __experimentalFeatures + })) + }); +} + +/* harmony default export */ var dropdown = ((0,external_wp_element_namespaceObject.forwardRef)(BlockNavigationDropdown)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-styles/preview-panel.js + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + +function BlockStylesPreviewPanel(_ref) { + let { + genericPreviewBlock, + style, + className, + activeStyle + } = _ref; + const styleClassName = replaceActiveStyle(className, activeStyle, style); + const previewBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => { + return { ...genericPreviewBlock, + title: style.label || style.name, + description: style.description, + initialAttributes: { ...genericPreviewBlock.attributes, + className: styleClassName + ' block-editor-block-styles__block-preview-container' + } + }; + }, [genericPreviewBlock, styleClassName]); + return (0,external_wp_element_namespaceObject.createElement)(preview_panel, { + item: previewBlocks, + isStylePreview: true + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-styles/index.js + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + + +function BlockStylesPreviewPanelSlot(_ref) { + let { + scope + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, { + name: `BlockStylesPreviewPanel/${scope}` + }); +} + +function BlockStylesPreviewPanelFill(_ref2) { + let { + children, + scope, + ...props + } = _ref2; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { + name: `BlockStylesPreviewPanel/${scope}` + }, (0,external_wp_element_namespaceObject.createElement)("div", props, children)); +} // Top position (in px) of the Block Styles container +// relative to the editor pane. +// The value is the equivalent of the container's right position. + + +const DEFAULT_POSITION_TOP = 16; // Block Styles component for the Settings Sidebar. + +function BlockStyles(_ref3) { + let { + clientId, + onSwitch = external_lodash_namespaceObject.noop, + onHoverClassName = external_lodash_namespaceObject.noop, + scope + } = _ref3; + const { + onSelect, + stylesToRender, + activeStyle, + genericPreviewBlock, + className: previewClassName + } = useStylesForBlocks({ + clientId, + onSwitch + }); + const [hoveredStyle, setHoveredStyle] = (0,external_wp_element_namespaceObject.useState)(null); + const [containerScrollTop, setContainerScrollTop] = (0,external_wp_element_namespaceObject.useState)(0); + const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); + (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { + const scrollContainer = document.querySelector('.interface-interface-skeleton__content'); + const scrollTop = (scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.scrollTop) || 0; + setContainerScrollTop(scrollTop + DEFAULT_POSITION_TOP); + }, [hoveredStyle]); + + if (!stylesToRender || stylesToRender.length === 0) { + return null; + } + + const debouncedSetHoveredStyle = (0,external_lodash_namespaceObject.debounce)(setHoveredStyle, 250); + + const onSelectStylePreview = style => { + onSelect(style); + onHoverClassName(null); + setHoveredStyle(null); + debouncedSetHoveredStyle.cancel(); + }; + + const styleItemHandler = item => { + var _item$name; + + if (hoveredStyle === item) { + debouncedSetHoveredStyle.cancel(); + return; + } + + debouncedSetHoveredStyle(item); + onHoverClassName((_item$name = item === null || item === void 0 ? void 0 : item.name) !== null && _item$name !== void 0 ? _item$name : null); + }; + + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-styles" + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-styles__variants" + }, stylesToRender.map(style => { + const buttonText = style.label || style.name; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + className: classnames_default()('block-editor-block-styles__item', { + 'is-active': activeStyle.name === style.name + }), + key: style.name, + variant: "secondary", + label: buttonText, + onMouseEnter: () => styleItemHandler(style), + onFocus: () => styleItemHandler(style), + onMouseLeave: () => styleItemHandler(null), + onBlur: () => styleItemHandler(null), + onKeyDown: event => { + if (external_wp_keycodes_namespaceObject.ENTER === event.keyCode || external_wp_keycodes_namespaceObject.SPACE === event.keyCode) { + event.preventDefault(); + onSelectStylePreview(style); + } + }, + onClick: () => onSelectStylePreview(style), + role: "button", + tabIndex: "0" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, { + numberOfLines: 1, + className: "block-editor-block-styles__item-text" + }, buttonText)); + })), hoveredStyle && !isMobileViewport && (0,external_wp_element_namespaceObject.createElement)(BlockStylesPreviewPanelFill, { + scope: scope, + className: "block-editor-block-styles__preview-panel", + style: { + top: containerScrollTop + }, + onMouseLeave: () => styleItemHandler(null) + }, (0,external_wp_element_namespaceObject.createElement)(BlockStylesPreviewPanel, { + activeStyle: activeStyle, + className: previewClassName, + genericPreviewBlock: genericPreviewBlock, + style: hoveredStyle + }))); +} + +BlockStyles.Slot = BlockStylesPreviewPanelSlot; +/* harmony default export */ var block_styles = (BlockStyles); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js + + +/** + * WordPress dependencies + */ + +const layout = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" +})); +/* harmony default export */ var library_layout = (layout); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-variation-picker/index.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + +function BlockVariationPicker(_ref) { + let { + icon = library_layout, + label = (0,external_wp_i18n_namespaceObject.__)('Choose variation'), + instructions = (0,external_wp_i18n_namespaceObject.__)('Select a variation to start with.'), + variations, + onSelect, + allowSkip + } = _ref; + const classes = classnames_default()('block-editor-block-variation-picker', { + 'has-many-variations': variations.length > 4 + }); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, { + icon: icon, + label: label, + instructions: instructions, + className: classes + }, (0,external_wp_element_namespaceObject.createElement)("ul", { + className: "block-editor-block-variation-picker__variations", + role: "list", + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Block variations') + }, variations.map(variation => (0,external_wp_element_namespaceObject.createElement)("li", { + key: variation.name + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + variant: "secondary", + icon: variation.icon, + iconSize: 48, + onClick: () => onSelect(variation), + className: "block-editor-block-variation-picker__variation", + label: variation.description || variation.title + }), (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-block-variation-picker__variation-label", + role: "presentation" + }, variation.title)))), allowSkip && (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-variation-picker__skip" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + variant: "link", + onClick: () => onSelect() + }, (0,external_wp_i18n_namespaceObject.__)('Skip')))); +} + +/* harmony default export */ var block_variation_picker = (BlockVariationPicker); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/grid.js + + +/** + * WordPress dependencies + */ + +const grid = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7.8 16.5H5c-.3 0-.5-.2-.5-.5v-6.2h6.8v6.7zm0-8.3H4.5V5c0-.3.2-.5.5-.5h6.2v6.7zm8.3 7.8c0 .3-.2.5-.5.5h-6.2v-6.8h6.8V19zm0-7.8h-6.8V4.5H19c.3 0 .5.2.5.5v6.2z", + fillRule: "evenodd", + clipRule: "evenodd" +})); +/* harmony default export */ var library_grid = (grid); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/constants.js +const VIEWMODES = { + carousel: 'carousel', + grid: 'grid' +}; + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/setup-toolbar.js + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + +const Actions = _ref => { + let { + onStartBlank, + onBlockPatternSelect + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-pattern-setup__actions" + }, onStartBlank && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + onClick: onStartBlank + }, (0,external_wp_i18n_namespaceObject.__)('Start blank')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + variant: "primary", + onClick: onBlockPatternSelect + }, (0,external_wp_i18n_namespaceObject.__)('Choose'))); +}; + +const CarouselNavigation = _ref2 => { + let { + handlePrevious, + handleNext, + activeSlide, + totalSlides + } = _ref2; + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-pattern-setup__navigation" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + icon: chevron_left, + label: (0,external_wp_i18n_namespaceObject.__)('Previous pattern'), + onClick: handlePrevious, + disabled: activeSlide === 0 + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + icon: chevron_right, + label: (0,external_wp_i18n_namespaceObject.__)('Next pattern'), + onClick: handleNext, + disabled: activeSlide === totalSlides - 1 + })); +}; + +const SetupToolbar = _ref3 => { + let { + viewMode, + setViewMode, + handlePrevious, + handleNext, + activeSlide, + totalSlides, + onBlockPatternSelect, + onStartBlank + } = _ref3; + const isCarouselView = viewMode === VIEWMODES.carousel; + const displayControls = (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-pattern-setup__display-controls" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + icon: stretch_full_width, + label: (0,external_wp_i18n_namespaceObject.__)('Carousel view'), + onClick: () => setViewMode(VIEWMODES.carousel), + isPressed: isCarouselView + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + icon: library_grid, + label: (0,external_wp_i18n_namespaceObject.__)('Grid view'), + onClick: () => setViewMode(VIEWMODES.grid), + isPressed: viewMode === VIEWMODES.grid + })); + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-pattern-setup__toolbar" + }, isCarouselView && (0,external_wp_element_namespaceObject.createElement)(CarouselNavigation, { + handlePrevious: handlePrevious, + handleNext: handleNext, + activeSlide: activeSlide, + totalSlides: totalSlides + }), displayControls, isCarouselView && (0,external_wp_element_namespaceObject.createElement)(Actions, { + onBlockPatternSelect: onBlockPatternSelect, + onStartBlank: onStartBlank + })); +}; + +/* harmony default export */ var setup_toolbar = (SetupToolbar); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/use-patterns-setup.js +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + +function usePatternsSetup(clientId, blockName, filterPatternsFn) { + return (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getBlockRootClientId, + __experimentalGetPatternsByBlockTypes, + __experimentalGetAllowedPatterns + } = select(store); + const rootClientId = getBlockRootClientId(clientId); + + if (filterPatternsFn) { + return __experimentalGetAllowedPatterns(rootClientId).filter(filterPatternsFn); + } + + return __experimentalGetPatternsByBlockTypes(blockName, rootClientId); + }, [clientId, blockName, filterPatternsFn]); +} + +/* harmony default export */ var use_patterns_setup = (usePatternsSetup); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/index.js + + + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + + + + + +const SetupContent = _ref => { + let { + viewMode, + activeSlide, + patterns, + onBlockPatternSelect, + height + } = _ref; + const composite = (0,external_wp_components_namespaceObject.__unstableUseCompositeState)(); + const containerClass = 'block-editor-block-pattern-setup__container'; + + if (viewMode === VIEWMODES.carousel) { + const slideClass = new Map([[activeSlide, 'active-slide'], [activeSlide - 1, 'previous-slide'], [activeSlide + 1, 'next-slide']]); + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-pattern-setup__carousel", + style: { + height + } + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: containerClass + }, (0,external_wp_element_namespaceObject.createElement)("ul", { + className: "carousel-container" + }, patterns.map((pattern, index) => (0,external_wp_element_namespaceObject.createElement)(BlockPatternSlide, { + className: slideClass.get(index) || '', + key: pattern.name, + pattern: pattern, + minHeight: height + }))))); + } + + return (0,external_wp_element_namespaceObject.createElement)("div", { + style: { + height + }, + className: "block-editor-block-pattern-setup__grid" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableComposite, _extends({}, composite, { + role: "listbox", + className: containerClass, + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Patterns list') + }), patterns.map(pattern => (0,external_wp_element_namespaceObject.createElement)(block_pattern_setup_BlockPattern, { + key: pattern.name, + pattern: pattern, + onSelect: onBlockPatternSelect, + composite: composite + })))); +}; + +function block_pattern_setup_BlockPattern(_ref2) { + let { + pattern, + onSelect, + composite + } = _ref2; + const baseClassName = 'block-editor-block-pattern-setup-list'; + const { + blocks, + description, + viewportWidth = 700 + } = pattern; + const descriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)(block_pattern_setup_BlockPattern, `${baseClassName}__item-description`); + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: `${baseClassName}__list-item`, + "aria-label": pattern.title, + "aria-describedby": pattern.description ? descriptionId : undefined + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableCompositeItem, _extends({ + role: "option", + as: "div" + }, composite, { + className: `${baseClassName}__item`, + onClick: () => onSelect(blocks) + }), (0,external_wp_element_namespaceObject.createElement)(block_preview, { + blocks: blocks, + viewportWidth: viewportWidth + })), !!description && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { + id: descriptionId + }, description)); +} + +function BlockPatternSlide(_ref3) { + let { + className, + pattern, + minHeight + } = _ref3; + const { + blocks, + title, + description + } = pattern; + const descriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockPatternSlide, 'block-editor-block-pattern-setup-list__item-description'); + return (0,external_wp_element_namespaceObject.createElement)("li", { + className: `pattern-slide ${className}`, + "aria-label": title, + "aria-describedby": description ? descriptionId : undefined + }, (0,external_wp_element_namespaceObject.createElement)(block_preview, { + blocks: blocks, + __experimentalMinHeight: minHeight + }), !!description && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { + id: descriptionId + }, description)); +} + +const BlockPatternSetup = _ref4 => { + let { + clientId, + blockName, + filterPatternsFn, + startBlankComponent, + onBlockPatternSelect + } = _ref4; + const [viewMode, setViewMode] = (0,external_wp_element_namespaceObject.useState)(VIEWMODES.carousel); + const [activeSlide, setActiveSlide] = (0,external_wp_element_namespaceObject.useState)(0); + const [showBlank, setShowBlank] = (0,external_wp_element_namespaceObject.useState)(false); + const { + replaceBlock + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const patterns = use_patterns_setup(clientId, blockName, filterPatternsFn); + const [contentResizeListener, { + height: contentHeight + }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); + + if (!(patterns !== null && patterns !== void 0 && patterns.length) || showBlank) { + return startBlankComponent; + } + + const onBlockPatternSelectDefault = blocks => { + const clonedBlocks = blocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block)); + replaceBlock(clientId, clonedBlocks); + }; + + const onPatternSelectCallback = onBlockPatternSelect || onBlockPatternSelectDefault; + const onStartBlank = startBlankComponent ? () => { + setShowBlank(true); + } : undefined; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, contentResizeListener, (0,external_wp_element_namespaceObject.createElement)("div", { + className: `block-editor-block-pattern-setup view-mode-${viewMode}` + }, (0,external_wp_element_namespaceObject.createElement)(SetupContent, { + viewMode: viewMode, + activeSlide: activeSlide, + patterns: patterns, + onBlockPatternSelect: onPatternSelectCallback, + height: contentHeight - 2 * 60 + }), (0,external_wp_element_namespaceObject.createElement)(setup_toolbar, { + viewMode: viewMode, + setViewMode: setViewMode, + activeSlide: activeSlide, + totalSlides: patterns.length, + handleNext: () => { + setActiveSlide(active => active + 1); + }, + handlePrevious: () => { + setActiveSlide(active => active - 1); + }, + onBlockPatternSelect: () => { + onPatternSelectCallback(patterns[activeSlide].blocks); + }, + onStartBlank: onStartBlank + }))); +}; + +/* harmony default export */ var block_pattern_setup = (BlockPatternSetup); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-variation-transforms/index.js + + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + +function VariationsButtons(_ref) { + let { + className, + onSelectVariation, + selectedValue, + variations + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)("fieldset", { + className: className + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { + as: "legend" + }, (0,external_wp_i18n_namespaceObject.__)('Transform to variation')), variations.map(variation => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + key: variation.name, + icon: variation.icon, + isPressed: selectedValue === variation.name, + label: selectedValue === variation.name ? variation.title : (0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %s: Name of the block variation */ + (0,external_wp_i18n_namespaceObject.__)('Transform to %s'), variation.title), + onClick: () => onSelectVariation(variation.name), + "aria-label": variation.title, + showTooltip: true + }))); +} + +function VariationsDropdown(_ref2) { + let { + className, + onSelectVariation, + selectedValue, + variations + } = _ref2; + const selectOptions = variations.map(_ref3 => { + let { + name, + title, + description + } = _ref3; + return { + value: name, + label: title, + info: description + }; + }); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, { + className: className, + label: (0,external_wp_i18n_namespaceObject.__)('Transform to variation'), + text: (0,external_wp_i18n_namespaceObject.__)('Transform to variation'), + popoverProps: { + position: 'bottom center', + className: `${className}__popover` + }, + icon: chevron_down, + toggleProps: { + iconPosition: 'right' + } + }, () => (0,external_wp_element_namespaceObject.createElement)("div", { + className: `${className}__container` + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, { + choices: selectOptions, + value: selectedValue, + onSelect: onSelectVariation + })))); +} + +function __experimentalBlockVariationTransforms(_ref4) { + let { + blockClientId + } = _ref4; + const { + updateBlockAttributes + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const { + activeBlockVariation, + variations + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getActiveBlockVariation, + getBlockVariations + } = select(external_wp_blocks_namespaceObject.store); + const { + getBlockName, + getBlockAttributes + } = select(store); + const name = blockClientId && getBlockName(blockClientId); + return { + activeBlockVariation: getActiveBlockVariation(name, getBlockAttributes(blockClientId)), + variations: name && getBlockVariations(name, 'transform') + }; + }, [blockClientId]); + const selectedValue = activeBlockVariation === null || activeBlockVariation === void 0 ? void 0 : activeBlockVariation.name; // Check if each variation has a unique icon. + + const hasUniqueIcons = (0,external_wp_element_namespaceObject.useMemo)(() => { + const variationIcons = new Set(); + + if (!variations) { + return false; + } + + variations.forEach(variation => { + if (variation.icon) { + variationIcons.add(variation.icon); + } + }); + return variationIcons.size === variations.length; + }, [variations]); + + const onSelectVariation = variationName => { + updateBlockAttributes(blockClientId, { ...variations.find(_ref5 => { + let { + name + } = _ref5; + return name === variationName; + }).attributes + }); + }; + + const baseClass = 'block-editor-block-variation-transforms'; // Skip rendering if there are no variations + + if (!(variations !== null && variations !== void 0 && variations.length)) return null; + const Component = hasUniqueIcons ? VariationsButtons : VariationsDropdown; + return (0,external_wp_element_namespaceObject.createElement)(Component, { + className: baseClass, + onSelectVariation: onSelectVariation, + selectedValue: selectedValue, + variations: variations + }); +} + +/* harmony default export */ var block_variation_transforms = (__experimentalBlockVariationTransforms); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-palette/with-color-context.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +/* harmony default export */ var with_color_context = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => { + return props => { + const colorsFeature = useSetting('color.palette'); + const disableCustomColorsFeature = !useSetting('color.custom'); + const colors = props.colors === undefined ? colorsFeature : props.colors; + const disableCustomColors = props.disableCustomColors === undefined ? disableCustomColorsFeature : props.disableCustomColors; + const hasColorsToChoose = !(0,external_lodash_namespaceObject.isEmpty)(colors) || !disableCustomColors; + return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, _extends({}, props, { + colors, + disableCustomColors, + hasColorsToChoose + })); + }; +}, 'withColorContext')); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-palette/index.js +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + +/* harmony default export */ var color_palette = (with_color_context(external_wp_components_namespaceObject.ColorPalette)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-palette/control.js + + + +/** + * Internal dependencies + */ + +function ColorPaletteControl(_ref) { + let { + onChange, + value, + ...otherProps + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)(control, _extends({}, otherProps, { + onColorChange: onChange, + colorValue: value, + gradients: [], + disableCustomGradients: true + })); +} + +;// CONCATENATED MODULE: external ["wp","date"] +var external_wp_date_namespaceObject = window["wp"]["date"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/date-format-picker/index.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + // So that we can illustrate the different formats in the dropdown properly, +// show a date that has a day greater than 12 and a month with more than three +// letters. Here we're using 2022-01-25 which is when WordPress 5.9 was +// released. + +const EXAMPLE_DATE = new Date(2022, 0, 25); +/** + * The `DateFormatPicker` component renders controls that let the user choose a + * _date format_. That is, how they want their dates to be formatted. + * + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/date-format-picker/README.md + * + * @param {Object} props + * @param {string|null} props.format The selected date + * format. If + * `null`, + * _Default_ is + * selected. + * @param {string} props.defaultFormat The date format that + * will be used if the + * user selects + * 'Default'. + * @param {( format: string|null ) => void} props.onChange Called when a + * selection is + * made. If `null`, + * _Default_ is + * selected. + */ + +function DateFormatPicker(_ref) { + let { + format, + defaultFormat, + onChange + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)("fieldset", { + className: "block-editor-date-format-picker" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { + as: "legend" + }, (0,external_wp_i18n_namespaceObject.__)('Date format')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, { + label: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('Default format'), (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-date-format-picker__default-format-toggle-control__hint" + }, (0,external_wp_date_namespaceObject.dateI18n)(defaultFormat, EXAMPLE_DATE))), + checked: !format, + onChange: checked => onChange(checked ? null : defaultFormat) + }), format && (0,external_wp_element_namespaceObject.createElement)(NonDefaultControls, { + format: format, + onChange: onChange + })); +} + +function NonDefaultControls(_ref2) { + var _suggestedOptions$fin; + + let { + format, + onChange + } = _ref2; + // Suggest a short format, medium format, long format, and a standardised + // (YYYY-MM-DD) format. The short, medium, and long formats are localised as + // different languages have different ways of writing these. For example, 'F + // j, Y' (April 20, 2022) in American English (en_US) is 'j. F Y' (20. April + // 2022) in German (de). The resultant array is de-duplicated as some + // languages will use the same format string for short, medium, and long + // formats. + const suggestedFormats = (0,external_lodash_namespaceObject.uniq)(['Y-m-d', (0,external_wp_i18n_namespaceObject._x)('n/j/Y', 'short date format'), (0,external_wp_i18n_namespaceObject._x)('n/j/Y g:i A', 'short date format with time'), (0,external_wp_i18n_namespaceObject._x)('M j, Y', 'medium date format'), (0,external_wp_i18n_namespaceObject._x)('M j, Y g:i A', 'medium date format with time'), (0,external_wp_i18n_namespaceObject._x)('F j, Y', 'long date format')]); + const suggestedOptions = suggestedFormats.map((suggestedFormat, index) => ({ + key: `suggested-${index}`, + name: (0,external_wp_date_namespaceObject.dateI18n)(suggestedFormat, EXAMPLE_DATE), + format: suggestedFormat + })); + const customOption = { + key: 'custom', + name: (0,external_wp_i18n_namespaceObject.__)('Custom'), + className: 'block-editor-date-format-picker__custom-format-select-control__custom-option', + __experimentalHint: (0,external_wp_i18n_namespaceObject.__)('Enter your own date format') + }; + const [isCustom, setIsCustom] = (0,external_wp_element_namespaceObject.useState)(() => !!format && !suggestedFormats.includes(format)); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, { + className: "block-editor-date-format-picker__custom-format-select-control" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CustomSelectControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Choose a format'), + options: [...suggestedOptions, customOption], + value: isCustom ? customOption : (_suggestedOptions$fin = suggestedOptions.find(option => option.format === format)) !== null && _suggestedOptions$fin !== void 0 ? _suggestedOptions$fin : customOption, + onChange: _ref3 => { + let { + selectedItem + } = _ref3; + + if (selectedItem === customOption) { + setIsCustom(true); + } else { + setIsCustom(false); + onChange(selectedItem.format); + } + } + })), isCustom && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Custom format'), + hideLabelFromVision: true, + help: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Enter a date or time format string.'), { + Link: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { + href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/formatting-date-and-time/') + }) + }), + value: format, + onChange: value => onChange(value) + })); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/panel-color-gradient-settings.js + + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + + + + // translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000) + +const colorIndicatorAriaLabel = (0,external_wp_i18n_namespaceObject.__)('(%s: color %s)'); // translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000) + + +const gradientIndicatorAriaLabel = (0,external_wp_i18n_namespaceObject.__)('(%s: gradient %s)'); + +const panel_color_gradient_settings_colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients']; + +const Indicators = _ref => { + let { + colors, + gradients, + settings + } = _ref; + return settings.map((_ref2, index) => { + let { + colorValue, + gradientValue, + label, + colors: availableColors, + gradients: availableGradients + } = _ref2; + + if (!colorValue && !gradientValue) { + return null; + } + + let ariaLabel; + + if (colorValue) { + const colorObject = getColorObjectByColorValue(availableColors || colors, colorValue); + ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)(colorIndicatorAriaLabel, label.toLowerCase(), colorObject && colorObject.name || colorValue); + } else { + const gradientObject = __experimentalGetGradientObjectByGradientValue(availableGradients || gradients, colorValue); + + ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)(gradientIndicatorAriaLabel, label.toLowerCase(), gradientObject && gradientObject.name || gradientValue); + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, { + key: index, + colorValue: colorValue || gradientValue, + "aria-label": ariaLabel + }); + }); +}; + +const PanelColorGradientSettingsInner = _ref3 => { + let { + className, + colors, + gradients, + disableCustomColors, + disableCustomGradients, + children, + settings, + title, + showTitle = true, + __experimentalHasMultipleOrigins, + __experimentalIsRenderedInSidebar, + enableAlpha, + ...props + } = _ref3; + + if ((0,external_lodash_namespaceObject.isEmpty)(colors) && (0,external_lodash_namespaceObject.isEmpty)(gradients) && disableCustomColors && disableCustomGradients && (0,external_lodash_namespaceObject.every)(settings, setting => (0,external_lodash_namespaceObject.isEmpty)(setting.colors) && (0,external_lodash_namespaceObject.isEmpty)(setting.gradients) && (setting.disableCustomColors === undefined || setting.disableCustomColors) && (setting.disableCustomGradients === undefined || setting.disableCustomGradients))) { + return null; + } + + const titleElement = (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-panel-color-gradient-settings__panel-title" + }, title, (0,external_wp_element_namespaceObject.createElement)(Indicators, { + colors: colors, + gradients: gradients, + settings: settings + })); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, _extends({ + className: classnames_default()('block-editor-panel-color-gradient-settings', className), + title: showTitle ? titleElement : undefined + }, props), (0,external_wp_element_namespaceObject.createElement)(ColorGradientSettingsDropdown, { + settings: settings, + colors, + gradients, + disableCustomColors, + disableCustomGradients, + __experimentalHasMultipleOrigins, + __experimentalIsRenderedInSidebar, + enableAlpha + }), !!children && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, { + marginY: 4 + }), " ", children)); +}; + +const PanelColorGradientSettingsSingleSelect = props => { + const colorGradientSettings = useCommonSingleMultipleSelects(); + colorGradientSettings.colors = useSetting('color.palette'); + colorGradientSettings.gradients = useSetting('color.gradients'); + return (0,external_wp_element_namespaceObject.createElement)(PanelColorGradientSettingsInner, _extends({}, colorGradientSettings, props)); +}; + +const PanelColorGradientSettingsMultipleSelect = props => { + const colorGradientSettings = useMultipleOriginColorsAndGradients(); + return (0,external_wp_element_namespaceObject.createElement)(PanelColorGradientSettingsInner, _extends({}, colorGradientSettings, props)); +}; + +const PanelColorGradientSettings = props => { + if ((0,external_lodash_namespaceObject.every)(panel_color_gradient_settings_colorsAndGradientKeys, key => props.hasOwnProperty(key))) { + return (0,external_wp_element_namespaceObject.createElement)(PanelColorGradientSettingsInner, props); + } + + if (props.__experimentalHasMultipleOrigins) { + return (0,external_wp_element_namespaceObject.createElement)(PanelColorGradientSettingsMultipleSelect, props); + } + + return (0,external_wp_element_namespaceObject.createElement)(PanelColorGradientSettingsSingleSelect, props); +}; + +/* harmony default export */ var panel_color_gradient_settings = (PanelColorGradientSettings); + +;// CONCATENATED MODULE: ./node_modules/react-easy-crop/node_modules/tslib/tslib.es6.js +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; + +function __extends(d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +var __assign = function() { + __assign = Object.assign || function __assign(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; + } + return __assign.apply(this, arguments); +} + +function __rest(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 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +} + +function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} + +function __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +} + +function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} + +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + +var __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +}); + +function __exportStar(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); +} + +function __values(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +} + +function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +} + +function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} + +function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +}; + +function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} + +function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +} + +function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } +} + +function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +} + +function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; + +var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}; + +function __importStar(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +} + +function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +} + +function __classPrivateFieldGet(receiver, privateMap) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to get private field on non-instance"); + } + return privateMap.get(receiver); +} + +function __classPrivateFieldSet(receiver, privateMap, value) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to set private field on non-instance"); + } + privateMap.set(receiver, value); + return value; +} + +// EXTERNAL MODULE: ./node_modules/normalize-wheel/index.js +var normalize_wheel = __webpack_require__(7970); +var normalize_wheel_default = /*#__PURE__*/__webpack_require__.n(normalize_wheel); +;// CONCATENATED MODULE: ./node_modules/react-easy-crop/index.module.js + + + + +/** + * Compute the dimension of the crop area based on media size, + * aspect ratio and optionally rotation + */ + +function getCropSize(mediaWidth, mediaHeight, containerWidth, containerHeight, aspect, rotation) { + if (rotation === void 0) { + rotation = 0; + } + + var _a = translateSize(mediaWidth, mediaHeight, rotation), + width = _a.width, + height = _a.height; + + var fittingWidth = Math.min(width, containerWidth); + var fittingHeight = Math.min(height, containerHeight); + + if (fittingWidth > fittingHeight * aspect) { + return { + width: fittingHeight * aspect, + height: fittingHeight + }; + } + + return { + width: fittingWidth, + height: fittingWidth / aspect + }; +} +/** + * Ensure a new media position stays in the crop area. + */ + +function restrictPosition(position, mediaSize, cropSize, zoom, rotation) { + if (rotation === void 0) { + rotation = 0; + } + + var _a = translateSize(mediaSize.width, mediaSize.height, rotation), + width = _a.width, + height = _a.height; + + return { + x: restrictPositionCoord(position.x, width, cropSize.width, zoom), + y: restrictPositionCoord(position.y, height, cropSize.height, zoom) + }; +} + +function restrictPositionCoord(position, mediaSize, cropSize, zoom) { + var maxPosition = mediaSize * zoom / 2 - cropSize / 2; + return Math.min(maxPosition, Math.max(position, -maxPosition)); +} + +function getDistanceBetweenPoints(pointA, pointB) { + return Math.sqrt(Math.pow(pointA.y - pointB.y, 2) + Math.pow(pointA.x - pointB.x, 2)); +} +function getRotationBetweenPoints(pointA, pointB) { + return Math.atan2(pointB.y - pointA.y, pointB.x - pointA.x) * 180 / Math.PI; +} +/** + * Compute the output cropped area of the media in percentages and pixels. + * x/y are the top-left coordinates on the src media + */ + +function computeCroppedArea(crop, mediaSize, cropSize, aspect, zoom, rotation, restrictPosition) { + if (rotation === void 0) { + rotation = 0; + } + + if (restrictPosition === void 0) { + restrictPosition = true; + } // if the media is rotated by the user, we cannot limit the position anymore + // as it might need to be negative. + + + var limitAreaFn = restrictPosition && rotation === 0 ? limitArea : noOp; + var croppedAreaPercentages = { + x: limitAreaFn(100, ((mediaSize.width - cropSize.width / zoom) / 2 - crop.x / zoom) / mediaSize.width * 100), + y: limitAreaFn(100, ((mediaSize.height - cropSize.height / zoom) / 2 - crop.y / zoom) / mediaSize.height * 100), + width: limitAreaFn(100, cropSize.width / mediaSize.width * 100 / zoom), + height: limitAreaFn(100, cropSize.height / mediaSize.height * 100 / zoom) + }; // we compute the pixels size naively + + var widthInPixels = Math.round(limitAreaFn(mediaSize.naturalWidth, croppedAreaPercentages.width * mediaSize.naturalWidth / 100)); + var heightInPixels = Math.round(limitAreaFn(mediaSize.naturalHeight, croppedAreaPercentages.height * mediaSize.naturalHeight / 100)); + var isImgWiderThanHigh = mediaSize.naturalWidth >= mediaSize.naturalHeight * aspect; // then we ensure the width and height exactly match the aspect (to avoid rounding approximations) + // if the media is wider than high, when zoom is 0, the crop height will be equals to iamge height + // thus we want to compute the width from the height and aspect for accuracy. + // Otherwise, we compute the height from width and aspect. + + var sizePixels = isImgWiderThanHigh ? { + width: Math.round(heightInPixels * aspect), + height: heightInPixels + } : { + width: widthInPixels, + height: Math.round(widthInPixels / aspect) + }; + + var croppedAreaPixels = __assign(__assign({}, sizePixels), { + x: Math.round(limitAreaFn(mediaSize.naturalWidth - sizePixels.width, croppedAreaPercentages.x * mediaSize.naturalWidth / 100)), + y: Math.round(limitAreaFn(mediaSize.naturalHeight - sizePixels.height, croppedAreaPercentages.y * mediaSize.naturalHeight / 100)) + }); + + return { + croppedAreaPercentages: croppedAreaPercentages, + croppedAreaPixels: croppedAreaPixels + }; +} +/** + * Ensure the returned value is between 0 and max + */ + +function limitArea(max, value) { + return Math.min(max, Math.max(0, value)); +} + +function noOp(_max, value) { + return value; +} +/** + * Compute the crop and zoom from the croppedAreaPixels + */ + + +function getZoomFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize) { + var mediaZoom = mediaSize.width / mediaSize.naturalWidth; + + if (cropSize) { + var isHeightMaxSize_1 = cropSize.height > cropSize.width; + return isHeightMaxSize_1 ? cropSize.height / mediaZoom / croppedAreaPixels.height : cropSize.width / mediaZoom / croppedAreaPixels.width; + } + + var aspect = croppedAreaPixels.width / croppedAreaPixels.height; + var isHeightMaxSize = mediaSize.naturalWidth >= mediaSize.naturalHeight * aspect; + return isHeightMaxSize ? mediaSize.naturalHeight / croppedAreaPixels.height : mediaSize.naturalWidth / croppedAreaPixels.width; +} +/** + * Compute the crop and zoom from the croppedAreaPixels + */ + + +function getInitialCropFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize) { + var mediaZoom = mediaSize.width / mediaSize.naturalWidth; + var zoom = getZoomFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize); + var cropZoom = mediaZoom * zoom; + var crop = { + x: ((mediaSize.naturalWidth - croppedAreaPixels.width) / 2 - croppedAreaPixels.x) * cropZoom, + y: ((mediaSize.naturalHeight - croppedAreaPixels.height) / 2 - croppedAreaPixels.y) * cropZoom + }; + return { + crop: crop, + zoom: zoom + }; +} +/** + * Return the point that is the center of point a and b + */ + +function getCenter(a, b) { + return { + x: (b.x + a.x) / 2, + y: (b.y + a.y) / 2 + }; +} +/** + * + * Returns an x,y point once rotated around xMid,yMid + */ + +function rotateAroundMidPoint(x, y, xMid, yMid, degrees) { + var cos = Math.cos; + var sin = Math.sin; + var radian = degrees * Math.PI / 180; // Convert to radians + // Subtract midpoints, so that midpoint is translated to origin + // and add it in the end again + + var xr = (x - xMid) * cos(radian) - (y - yMid) * sin(radian) + xMid; + var yr = (x - xMid) * sin(radian) + (y - yMid) * cos(radian) + yMid; + return [xr, yr]; +} +/** + * Returns the new bounding area of a rotated rectangle. + */ + +function translateSize(width, height, rotation) { + var centerX = width / 2; + var centerY = height / 2; + var outerBounds = [rotateAroundMidPoint(0, 0, centerX, centerY, rotation), rotateAroundMidPoint(width, 0, centerX, centerY, rotation), rotateAroundMidPoint(width, height, centerX, centerY, rotation), rotateAroundMidPoint(0, height, centerX, centerY, rotation)]; + var minX = Math.min.apply(Math, outerBounds.map(function (p) { + return p[0]; + })); + var maxX = Math.max.apply(Math, outerBounds.map(function (p) { + return p[0]; + })); + var minY = Math.min.apply(Math, outerBounds.map(function (p) { + return p[1]; + })); + var maxY = Math.max.apply(Math, outerBounds.map(function (p) { + return p[1]; + })); + return { + width: maxX - minX, + height: maxY - minY + }; +} +/** + * Combine multiple class names into a single string. + */ + +function classNames() { + var args = []; + + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + + return args.filter(function (value) { + if (typeof value === 'string' && value.length > 0) { + return true; + } + + return false; + }).join(' ').trim(); +} + +var css_248z = ".reactEasyCrop_Container {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: hidden;\n user-select: none;\n touch-action: none;\n cursor: move;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.reactEasyCrop_Image,\n.reactEasyCrop_Video {\n will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */\n}\n\n.reactEasyCrop_Contain {\n max-width: 100%;\n max-height: 100%;\n margin: auto;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n}\n.reactEasyCrop_Cover_Horizontal {\n width: 100%;\n height: auto;\n}\n.reactEasyCrop_Cover_Vertical {\n width: auto;\n height: 100%;\n}\n\n.reactEasyCrop_CropArea {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n border: 1px solid rgba(255, 255, 255, 0.5);\n box-sizing: border-box;\n box-shadow: 0 0 0 9999em;\n color: rgba(0, 0, 0, 0.5);\n overflow: hidden;\n}\n\n.reactEasyCrop_CropAreaRound {\n border-radius: 50%;\n}\n\n.reactEasyCrop_CropAreaGrid::before {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 0;\n bottom: 0;\n left: 33.33%;\n right: 33.33%;\n border-top: 0;\n border-bottom: 0;\n}\n\n.reactEasyCrop_CropAreaGrid::after {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 33.33%;\n bottom: 33.33%;\n left: 0;\n right: 0;\n border-left: 0;\n border-right: 0;\n}\n"; + +var MIN_ZOOM = 1; +var MAX_ZOOM = 3; + +var Cropper = +/** @class */ +function (_super) { + __extends(Cropper, _super); + + function Cropper() { + var _this = _super !== null && _super.apply(this, arguments) || this; + + _this.imageRef = null; + _this.videoRef = null; + _this.containerRef = null; + _this.styleRef = null; + _this.containerRect = null; + _this.mediaSize = { + width: 0, + height: 0, + naturalWidth: 0, + naturalHeight: 0 + }; + _this.dragStartPosition = { + x: 0, + y: 0 + }; + _this.dragStartCrop = { + x: 0, + y: 0 + }; + _this.lastPinchDistance = 0; + _this.lastPinchRotation = 0; + _this.rafDragTimeout = null; + _this.rafPinchTimeout = null; + _this.wheelTimer = null; + _this.state = { + cropSize: null, + hasWheelJustStarted: false + }; // this is to prevent Safari on iOS >= 10 to zoom the page + + _this.preventZoomSafari = function (e) { + return e.preventDefault(); + }; + + _this.cleanEvents = function () { + document.removeEventListener('mousemove', _this.onMouseMove); + document.removeEventListener('mouseup', _this.onDragStopped); + document.removeEventListener('touchmove', _this.onTouchMove); + document.removeEventListener('touchend', _this.onDragStopped); + }; + + _this.clearScrollEvent = function () { + if (_this.containerRef) _this.containerRef.removeEventListener('wheel', _this.onWheel); + + if (_this.wheelTimer) { + clearTimeout(_this.wheelTimer); + } + }; + + _this.onMediaLoad = function () { + _this.computeSizes(); + + _this.emitCropData(); + + _this.setInitialCrop(); + + if (_this.props.onMediaLoaded) { + _this.props.onMediaLoaded(_this.mediaSize); + } + }; + + _this.setInitialCrop = function () { + var _a = _this.props, + initialCroppedAreaPixels = _a.initialCroppedAreaPixels, + cropSize = _a.cropSize; + + if (!initialCroppedAreaPixels) { + return; + } + + var _b = getInitialCropFromCroppedAreaPixels(initialCroppedAreaPixels, _this.mediaSize, cropSize), + crop = _b.crop, + zoom = _b.zoom; + + _this.props.onCropChange(crop); + + _this.props.onZoomChange && _this.props.onZoomChange(zoom); + }; + + _this.computeSizes = function () { + var _a, _b, _c, _d, _e, _f; + + var mediaRef = _this.imageRef || _this.videoRef; + + if (mediaRef && _this.containerRef) { + _this.containerRect = _this.containerRef.getBoundingClientRect(); + _this.mediaSize = { + width: mediaRef.offsetWidth, + height: mediaRef.offsetHeight, + naturalWidth: ((_a = _this.imageRef) === null || _a === void 0 ? void 0 : _a.naturalWidth) || ((_b = _this.videoRef) === null || _b === void 0 ? void 0 : _b.videoWidth) || 0, + naturalHeight: ((_c = _this.imageRef) === null || _c === void 0 ? void 0 : _c.naturalHeight) || ((_d = _this.videoRef) === null || _d === void 0 ? void 0 : _d.videoHeight) || 0 + }; + var cropSize = _this.props.cropSize ? _this.props.cropSize : getCropSize(mediaRef.offsetWidth, mediaRef.offsetHeight, _this.containerRect.width, _this.containerRect.height, _this.props.aspect, _this.props.rotation); + + if (((_e = _this.state.cropSize) === null || _e === void 0 ? void 0 : _e.height) !== cropSize.height || ((_f = _this.state.cropSize) === null || _f === void 0 ? void 0 : _f.width) !== cropSize.width) { + _this.props.onCropSizeChange && _this.props.onCropSizeChange(cropSize); + } + + _this.setState({ + cropSize: cropSize + }, _this.recomputeCropPosition); + } + }; + + _this.onMouseDown = function (e) { + e.preventDefault(); + document.addEventListener('mousemove', _this.onMouseMove); + document.addEventListener('mouseup', _this.onDragStopped); + + _this.onDragStart(Cropper.getMousePoint(e)); + }; + + _this.onMouseMove = function (e) { + return _this.onDrag(Cropper.getMousePoint(e)); + }; + + _this.onTouchStart = function (e) { + document.addEventListener('touchmove', _this.onTouchMove, { + passive: false + }); // iOS 11 now defaults to passive: true + + document.addEventListener('touchend', _this.onDragStopped); + + if (e.touches.length === 2) { + _this.onPinchStart(e); + } else if (e.touches.length === 1) { + _this.onDragStart(Cropper.getTouchPoint(e.touches[0])); + } + }; + + _this.onTouchMove = function (e) { + // Prevent whole page from scrolling on iOS. + e.preventDefault(); + + if (e.touches.length === 2) { + _this.onPinchMove(e); + } else if (e.touches.length === 1) { + _this.onDrag(Cropper.getTouchPoint(e.touches[0])); + } + }; + + _this.onDragStart = function (_a) { + var _b, _c; + + var x = _a.x, + y = _a.y; + _this.dragStartPosition = { + x: x, + y: y + }; + _this.dragStartCrop = __assign({}, _this.props.crop); + (_c = (_b = _this.props).onInteractionStart) === null || _c === void 0 ? void 0 : _c.call(_b); + }; + + _this.onDrag = function (_a) { + var x = _a.x, + y = _a.y; + if (_this.rafDragTimeout) window.cancelAnimationFrame(_this.rafDragTimeout); + _this.rafDragTimeout = window.requestAnimationFrame(function () { + if (!_this.state.cropSize) return; + if (x === undefined || y === undefined) return; + var offsetX = x - _this.dragStartPosition.x; + var offsetY = y - _this.dragStartPosition.y; + var requestedPosition = { + x: _this.dragStartCrop.x + offsetX, + y: _this.dragStartCrop.y + offsetY + }; + var newPosition = _this.props.restrictPosition ? restrictPosition(requestedPosition, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : requestedPosition; + + _this.props.onCropChange(newPosition); + }); + }; + + _this.onDragStopped = function () { + var _a, _b; + + _this.cleanEvents(); + + _this.emitCropData(); + + (_b = (_a = _this.props).onInteractionEnd) === null || _b === void 0 ? void 0 : _b.call(_a); + }; + + _this.onWheel = function (e) { + e.preventDefault(); + var point = Cropper.getMousePoint(e); + var pixelY = normalize_wheel_default()(e).pixelY; + var newZoom = _this.props.zoom - pixelY * _this.props.zoomSpeed / 200; + + _this.setNewZoom(newZoom, point); + + if (!_this.state.hasWheelJustStarted) { + _this.setState({ + hasWheelJustStarted: true + }, function () { + var _a, _b; + + return (_b = (_a = _this.props).onInteractionStart) === null || _b === void 0 ? void 0 : _b.call(_a); + }); + } + + if (_this.wheelTimer) { + clearTimeout(_this.wheelTimer); + } + + _this.wheelTimer = window.setTimeout(function () { + return _this.setState({ + hasWheelJustStarted: false + }, function () { + var _a, _b; + + return (_b = (_a = _this.props).onInteractionEnd) === null || _b === void 0 ? void 0 : _b.call(_a); + }); + }, 250); + }; + + _this.getPointOnContainer = function (_a) { + var x = _a.x, + y = _a.y; + + if (!_this.containerRect) { + throw new Error('The Cropper is not mounted'); + } + + return { + x: _this.containerRect.width / 2 - (x - _this.containerRect.left), + y: _this.containerRect.height / 2 - (y - _this.containerRect.top) + }; + }; + + _this.getPointOnMedia = function (_a) { + var x = _a.x, + y = _a.y; + var _b = _this.props, + crop = _b.crop, + zoom = _b.zoom; + return { + x: (x + crop.x) / zoom, + y: (y + crop.y) / zoom + }; + }; + + _this.setNewZoom = function (zoom, point) { + if (!_this.state.cropSize || !_this.props.onZoomChange) return; + + var zoomPoint = _this.getPointOnContainer(point); + + var zoomTarget = _this.getPointOnMedia(zoomPoint); + + var newZoom = Math.min(_this.props.maxZoom, Math.max(zoom, _this.props.minZoom)); + var requestedPosition = { + x: zoomTarget.x * newZoom - zoomPoint.x, + y: zoomTarget.y * newZoom - zoomPoint.y + }; + var newPosition = _this.props.restrictPosition ? restrictPosition(requestedPosition, _this.mediaSize, _this.state.cropSize, newZoom, _this.props.rotation) : requestedPosition; + + _this.props.onCropChange(newPosition); + + _this.props.onZoomChange(newZoom); + }; + + _this.getCropData = function () { + if (!_this.state.cropSize) { + return null; + } // this is to ensure the crop is correctly restricted after a zoom back (https://github.com/ricardo-ch/react-easy-crop/issues/6) + + + var restrictedPosition = _this.props.restrictPosition ? restrictPosition(_this.props.crop, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : _this.props.crop; + return computeCroppedArea(restrictedPosition, _this.mediaSize, _this.state.cropSize, _this.getAspect(), _this.props.zoom, _this.props.rotation, _this.props.restrictPosition); + }; + + _this.emitCropData = function () { + var cropData = _this.getCropData(); + + if (!cropData) return; + var croppedAreaPercentages = cropData.croppedAreaPercentages, + croppedAreaPixels = cropData.croppedAreaPixels; + + if (_this.props.onCropComplete) { + _this.props.onCropComplete(croppedAreaPercentages, croppedAreaPixels); + } + + if (_this.props.onCropAreaChange) { + _this.props.onCropAreaChange(croppedAreaPercentages, croppedAreaPixels); + } + }; + + _this.emitCropAreaChange = function () { + var cropData = _this.getCropData(); + + if (!cropData) return; + var croppedAreaPercentages = cropData.croppedAreaPercentages, + croppedAreaPixels = cropData.croppedAreaPixels; + + if (_this.props.onCropAreaChange) { + _this.props.onCropAreaChange(croppedAreaPercentages, croppedAreaPixels); + } + }; + + _this.recomputeCropPosition = function () { + if (!_this.state.cropSize) return; + var newPosition = _this.props.restrictPosition ? restrictPosition(_this.props.crop, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : _this.props.crop; + + _this.props.onCropChange(newPosition); + + _this.emitCropData(); + }; + + return _this; + } + + Cropper.prototype.componentDidMount = function () { + window.addEventListener('resize', this.computeSizes); + + if (this.containerRef) { + this.props.zoomWithScroll && this.containerRef.addEventListener('wheel', this.onWheel, { + passive: false + }); + this.containerRef.addEventListener('gesturestart', this.preventZoomSafari); + this.containerRef.addEventListener('gesturechange', this.preventZoomSafari); + } + + if (!this.props.disableAutomaticStylesInjection) { + this.styleRef = document.createElement('style'); + this.styleRef.setAttribute('type', 'text/css'); + this.styleRef.innerHTML = css_248z; + document.head.appendChild(this.styleRef); + } // when rendered via SSR, the image can already be loaded and its onLoad callback will never be called + + + if (this.imageRef && this.imageRef.complete) { + this.onMediaLoad(); + } + }; + + Cropper.prototype.componentWillUnmount = function () { + var _a; + + window.removeEventListener('resize', this.computeSizes); + + if (this.containerRef) { + this.containerRef.removeEventListener('gesturestart', this.preventZoomSafari); + this.containerRef.removeEventListener('gesturechange', this.preventZoomSafari); + } + + if (this.styleRef) { + (_a = this.styleRef.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this.styleRef); + } + + this.cleanEvents(); + this.props.zoomWithScroll && this.clearScrollEvent(); + }; + + Cropper.prototype.componentDidUpdate = function (prevProps) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j; + + if (prevProps.rotation !== this.props.rotation) { + this.computeSizes(); + this.recomputeCropPosition(); + } else if (prevProps.aspect !== this.props.aspect) { + this.computeSizes(); + } else if (prevProps.zoom !== this.props.zoom) { + this.recomputeCropPosition(); + } else if (((_a = prevProps.cropSize) === null || _a === void 0 ? void 0 : _a.height) !== ((_b = this.props.cropSize) === null || _b === void 0 ? void 0 : _b.height) || ((_c = prevProps.cropSize) === null || _c === void 0 ? void 0 : _c.width) !== ((_d = this.props.cropSize) === null || _d === void 0 ? void 0 : _d.width)) { + this.computeSizes(); + } else if (((_e = prevProps.crop) === null || _e === void 0 ? void 0 : _e.x) !== ((_f = this.props.crop) === null || _f === void 0 ? void 0 : _f.x) || ((_g = prevProps.crop) === null || _g === void 0 ? void 0 : _g.y) !== ((_h = this.props.crop) === null || _h === void 0 ? void 0 : _h.y)) { + this.emitCropAreaChange(); + } + + if (prevProps.zoomWithScroll !== this.props.zoomWithScroll && this.containerRef) { + this.props.zoomWithScroll ? this.containerRef.addEventListener('wheel', this.onWheel, { + passive: false + }) : this.clearScrollEvent(); + } + + if (prevProps.video !== this.props.video) { + (_j = this.videoRef) === null || _j === void 0 ? void 0 : _j.load(); + } + }; + + Cropper.prototype.getAspect = function () { + var _a = this.props, + cropSize = _a.cropSize, + aspect = _a.aspect; + + if (cropSize) { + return cropSize.width / cropSize.height; + } + + return aspect; + }; + + Cropper.prototype.onPinchStart = function (e) { + var pointA = Cropper.getTouchPoint(e.touches[0]); + var pointB = Cropper.getTouchPoint(e.touches[1]); + this.lastPinchDistance = getDistanceBetweenPoints(pointA, pointB); + this.lastPinchRotation = getRotationBetweenPoints(pointA, pointB); + this.onDragStart(getCenter(pointA, pointB)); + }; + + Cropper.prototype.onPinchMove = function (e) { + var _this = this; + + var pointA = Cropper.getTouchPoint(e.touches[0]); + var pointB = Cropper.getTouchPoint(e.touches[1]); + var center = getCenter(pointA, pointB); + this.onDrag(center); + if (this.rafPinchTimeout) window.cancelAnimationFrame(this.rafPinchTimeout); + this.rafPinchTimeout = window.requestAnimationFrame(function () { + var distance = getDistanceBetweenPoints(pointA, pointB); + var newZoom = _this.props.zoom * (distance / _this.lastPinchDistance); + + _this.setNewZoom(newZoom, center); + + _this.lastPinchDistance = distance; + var rotation = getRotationBetweenPoints(pointA, pointB); + var newRotation = _this.props.rotation + (rotation - _this.lastPinchRotation); + _this.props.onRotationChange && _this.props.onRotationChange(newRotation); + _this.lastPinchRotation = rotation; + }); + }; + + Cropper.prototype.render = function () { + var _this = this; + + var _a = this.props, + image = _a.image, + video = _a.video, + mediaProps = _a.mediaProps, + transform = _a.transform, + _b = _a.crop, + x = _b.x, + y = _b.y, + rotation = _a.rotation, + zoom = _a.zoom, + cropShape = _a.cropShape, + showGrid = _a.showGrid, + _c = _a.style, + containerStyle = _c.containerStyle, + cropAreaStyle = _c.cropAreaStyle, + mediaStyle = _c.mediaStyle, + _d = _a.classes, + containerClassName = _d.containerClassName, + cropAreaClassName = _d.cropAreaClassName, + mediaClassName = _d.mediaClassName, + objectFit = _a.objectFit; + return /*#__PURE__*/external_React_default().createElement("div", { + onMouseDown: this.onMouseDown, + onTouchStart: this.onTouchStart, + ref: function ref(el) { + return _this.containerRef = el; + }, + "data-testid": "container", + style: containerStyle, + className: classNames('reactEasyCrop_Container', containerClassName) + }, image ? /*#__PURE__*/external_React_default().createElement("img", __assign({ + alt: "", + className: classNames('reactEasyCrop_Image', objectFit === 'contain' && 'reactEasyCrop_Contain', objectFit === 'horizontal-cover' && 'reactEasyCrop_Cover_Horizontal', objectFit === 'vertical-cover' && 'reactEasyCrop_Cover_Vertical', mediaClassName) + }, mediaProps, { + src: image, + ref: function ref(el) { + return _this.imageRef = el; + }, + style: __assign(__assign({}, mediaStyle), { + transform: transform || "translate(" + x + "px, " + y + "px) rotate(" + rotation + "deg) scale(" + zoom + ")" + }), + onLoad: this.onMediaLoad + })) : video && /*#__PURE__*/external_React_default().createElement("video", __assign({ + autoPlay: true, + loop: true, + muted: true, + className: classNames('reactEasyCrop_Video', objectFit === 'contain' && 'reactEasyCrop_Contain', objectFit === 'horizontal-cover' && 'reactEasyCrop_Cover_Horizontal', objectFit === 'vertical-cover' && 'reactEasyCrop_Cover_Vertical', mediaClassName) + }, mediaProps, { + ref: function ref(el) { + return _this.videoRef = el; + }, + onLoadedMetadata: this.onMediaLoad, + style: __assign(__assign({}, mediaStyle), { + transform: transform || "translate(" + x + "px, " + y + "px) rotate(" + rotation + "deg) scale(" + zoom + ")" + }), + controls: false + }), (Array.isArray(video) ? video : [{ + src: video + }]).map(function (item) { + return /*#__PURE__*/external_React_default().createElement("source", __assign({ + key: item.src + }, item)); + })), this.state.cropSize && /*#__PURE__*/external_React_default().createElement("div", { + style: __assign(__assign({}, cropAreaStyle), { + width: this.state.cropSize.width, + height: this.state.cropSize.height + }), + "data-testid": "cropper", + className: classNames('reactEasyCrop_CropArea', cropShape === 'round' && 'reactEasyCrop_CropAreaRound', showGrid && 'reactEasyCrop_CropAreaGrid', cropAreaClassName) + })); + }; + + Cropper.defaultProps = { + zoom: 1, + rotation: 0, + aspect: 4 / 3, + maxZoom: MAX_ZOOM, + minZoom: MIN_ZOOM, + cropShape: 'rect', + objectFit: 'contain', + showGrid: true, + style: {}, + classes: {}, + mediaProps: {}, + zoomSpeed: 1, + restrictPosition: true, + zoomWithScroll: true + }; + + Cropper.getMousePoint = function (e) { + return { + x: Number(e.clientX), + y: Number(e.clientY) + }; + }; + + Cropper.getTouchPoint = function (touch) { + return { + x: Number(touch.clientX), + y: Number(touch.clientY) + }; + }; + + return Cropper; +}((external_React_default()).Component); + +/* harmony default export */ var index_module = (Cropper); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/constants.js +const constants_MIN_ZOOM = 100; +const constants_MAX_ZOOM = 300; +const constants_POPOVER_PROPS = { + position: 'bottom right', + isAlternate: true +}; + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/use-save-image.js +/** + * WordPress dependencies + */ + + + + + +function useSaveImage(_ref) { + let { + crop, + rotation, + height, + width, + aspect, + url, + id, + onSaveImage, + onFinishEditing + } = _ref; + const { + createErrorNotice + } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); + const [isInProgress, setIsInProgress] = (0,external_wp_element_namespaceObject.useState)(false); + const cancel = (0,external_wp_element_namespaceObject.useCallback)(() => { + setIsInProgress(false); + onFinishEditing(); + }, [setIsInProgress, onFinishEditing]); + const apply = (0,external_wp_element_namespaceObject.useCallback)(() => { + setIsInProgress(true); + let attrs = {}; // The crop script may return some very small, sub-pixel values when the image was not cropped. + // Crop only when the new size has changed by more than 0.1%. + + if (crop.width < 99.9 || crop.height < 99.9) { + attrs = crop; + } + + if (rotation > 0) { + attrs.rotation = rotation; + } + + attrs.src = url; + external_wp_apiFetch_default()({ + path: `/wp/v2/media/${id}/edit`, + method: 'POST', + data: attrs + }).then(response => { + onSaveImage({ + id: response.id, + url: response.source_url, + height: height && width ? width / aspect : undefined + }); + }).catch(error => { + createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: 1. Error message */ + (0,external_wp_i18n_namespaceObject.__)('Could not edit image. %s'), error.message), { + id: 'image-editing-error', + type: 'snackbar' + }); + }).finally(() => { + setIsInProgress(false); + onFinishEditing(); + }); + }, [setIsInProgress, crop, rotation, height, width, aspect, url, onSaveImage, createErrorNotice, setIsInProgress, onFinishEditing]); + return (0,external_wp_element_namespaceObject.useMemo)(() => ({ + isInProgress, + apply, + cancel + }), [isInProgress, apply, cancel]); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/use-transform-image.js +/** + * WordPress dependencies + */ + + + +function useTransformState(_ref) { + let { + url, + naturalWidth, + naturalHeight + } = _ref; + const [editedUrl, setEditedUrl] = (0,external_wp_element_namespaceObject.useState)(); + const [crop, setCrop] = (0,external_wp_element_namespaceObject.useState)(); + const [position, setPosition] = (0,external_wp_element_namespaceObject.useState)({ + x: 0, + y: 0 + }); + const [zoom, setZoom] = (0,external_wp_element_namespaceObject.useState)(); + const [rotation, setRotation] = (0,external_wp_element_namespaceObject.useState)(); + const [aspect, setAspect] = (0,external_wp_element_namespaceObject.useState)(); + const [defaultAspect, setDefaultAspect] = (0,external_wp_element_namespaceObject.useState)(); + const initializeTransformValues = (0,external_wp_element_namespaceObject.useCallback)(() => { + setPosition({ + x: 0, + y: 0 + }); + setZoom(100); + setRotation(0); + setAspect(naturalWidth / naturalHeight); + setDefaultAspect(naturalWidth / naturalHeight); + }, [naturalWidth, naturalHeight, setPosition, setZoom, setRotation, setAspect, setDefaultAspect]); + const rotateClockwise = (0,external_wp_element_namespaceObject.useCallback)(() => { + const angle = (rotation + 90) % 360; + let naturalAspectRatio = naturalWidth / naturalHeight; + + if (rotation % 180 === 90) { + naturalAspectRatio = naturalHeight / naturalWidth; + } + + if (angle === 0) { + setEditedUrl(); + setRotation(angle); + setAspect(1 / aspect); + setPosition({ + x: -(position.y * naturalAspectRatio), + y: position.x * naturalAspectRatio + }); + return; + } + + function editImage(event) { + const canvas = document.createElement('canvas'); + let translateX = 0; + let translateY = 0; + + if (angle % 180) { + canvas.width = event.target.height; + canvas.height = event.target.width; + } else { + canvas.width = event.target.width; + canvas.height = event.target.height; + } + + if (angle === 90 || angle === 180) { + translateX = canvas.width; + } + + if (angle === 270 || angle === 180) { + translateY = canvas.height; + } + + const context = canvas.getContext('2d'); + context.translate(translateX, translateY); + context.rotate(angle * Math.PI / 180); + context.drawImage(event.target, 0, 0); + canvas.toBlob(blob => { + setEditedUrl(URL.createObjectURL(blob)); + setRotation(angle); + setAspect(1 / aspect); + setPosition({ + x: -(position.y * naturalAspectRatio), + y: position.x * naturalAspectRatio + }); + }); + } + + const el = new window.Image(); + el.src = url; + el.onload = editImage; + const imgCrossOrigin = (0,external_wp_hooks_namespaceObject.applyFilters)('media.crossOrigin', undefined, url); + + if (typeof imgCrossOrigin === 'string') { + el.crossOrigin = imgCrossOrigin; + } + }, [rotation, naturalWidth, naturalHeight, setEditedUrl, setRotation, setAspect, setPosition]); + return (0,external_wp_element_namespaceObject.useMemo)(() => ({ + editedUrl, + setEditedUrl, + crop, + setCrop, + position, + setPosition, + zoom, + setZoom, + rotation, + setRotation, + rotateClockwise, + aspect, + setAspect, + defaultAspect, + initializeTransformValues + }), [editedUrl, setEditedUrl, crop, setCrop, position, setPosition, zoom, setZoom, rotation, setRotation, rotateClockwise, aspect, setAspect, defaultAspect, initializeTransformValues]); +} + +function useTransformImage(imageProperties, isEditing) { + const transformState = useTransformState(imageProperties); + const { + initializeTransformValues + } = transformState; + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (isEditing) { + initializeTransformValues(); + } + }, [isEditing, initializeTransformValues]); + return transformState; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/context.js + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + +const ImageEditingContext = (0,external_wp_element_namespaceObject.createContext)({}); +const useImageEditingContext = () => (0,external_wp_element_namespaceObject.useContext)(ImageEditingContext); +function ImageEditingProvider(_ref) { + let { + id, + url, + naturalWidth, + naturalHeight, + isEditing, + onFinishEditing, + onSaveImage, + children + } = _ref; + const transformImage = useTransformImage({ + url, + naturalWidth, + naturalHeight + }, isEditing); + const saveImage = useSaveImage({ + id, + url, + onSaveImage, + onFinishEditing, + ...transformImage + }); + const providerValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...transformImage, + ...saveImage + }), [transformImage, saveImage]); + return (0,external_wp_element_namespaceObject.createElement)(ImageEditingContext.Provider, { + value: providerValue + }, children); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/cropper.js + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + +function ImageCropper(_ref) { + let { + url, + width, + height, + clientWidth, + naturalHeight, + naturalWidth + } = _ref; + const { + isInProgress, + editedUrl, + position, + zoom, + aspect, + setPosition, + setCrop, + setZoom, + rotation + } = useImageEditingContext(); + let editedHeight = height || clientWidth * naturalHeight / naturalWidth; + + if (rotation % 180 === 90) { + editedHeight = clientWidth * naturalWidth / naturalHeight; + } + + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: classnames_default()('wp-block-image__crop-area', { + 'is-applying': isInProgress + }), + style: { + width: width || clientWidth, + height: editedHeight + } + }, (0,external_wp_element_namespaceObject.createElement)(index_module, { + image: editedUrl || url, + disabled: isInProgress, + minZoom: constants_MIN_ZOOM / 100, + maxZoom: constants_MAX_ZOOM / 100, + crop: position, + zoom: zoom / 100, + aspect: aspect, + onCropChange: setPosition, + onCropComplete: newCropPercent => { + setCrop(newCropPercent); + }, + onZoomChange: newZoom => { + setZoom(newZoom * 100); + } + }), isInProgress && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null)); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js + + +/** + * WordPress dependencies + */ + +const search = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z" +})); +/* harmony default export */ var library_search = (search); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/zoom-dropdown.js + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + +function ZoomDropdown() { + const { + isInProgress, + zoom, + setZoom + } = useImageEditingContext(); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { + contentClassName: "wp-block-image__zoom", + popoverProps: constants_POPOVER_PROPS, + renderToggle: _ref => { + let { + isOpen, + onToggle + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + icon: library_search, + label: (0,external_wp_i18n_namespaceObject.__)('Zoom'), + onClick: onToggle, + "aria-expanded": isOpen, + disabled: isInProgress + }); + }, + renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Zoom'), + min: constants_MIN_ZOOM, + max: constants_MAX_ZOOM, + value: Math.round(zoom), + onChange: setZoom + }) + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/aspect-ratio.js + + +/** + * WordPress dependencies + */ + +const aspectRatio = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M18.5 5.5h-13c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h13c1.1 0 2-.9 2-2v-9c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5h-13c-.3 0-.5-.2-.5-.5v-9c0-.3.2-.5.5-.5h13c.3 0 .5.2.5.5v9zM6.5 12H8v-2h2V8.5H6.5V12zm9.5 2h-2v1.5h3.5V12H16v2z" +})); +/* harmony default export */ var aspect_ratio = (aspectRatio); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/aspect-ratio-dropdown.js + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + +function AspectGroup(_ref) { + let { + aspectRatios, + isDisabled, + label, + onClick, + value + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { + label: label + }, aspectRatios.map(_ref2 => { + let { + title, + aspect + } = _ref2; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + key: aspect, + disabled: isDisabled, + onClick: () => { + onClick(aspect); + }, + role: "menuitemradio", + isSelected: aspect === value, + icon: aspect === value ? library_check : undefined + }, title); + })); +} + +function AspectRatioDropdown(_ref3) { + let { + toggleProps + } = _ref3; + const { + isInProgress, + aspect, + setAspect, + defaultAspect + } = useImageEditingContext(); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, { + icon: aspect_ratio, + label: (0,external_wp_i18n_namespaceObject.__)('Aspect Ratio'), + popoverProps: constants_POPOVER_PROPS, + toggleProps: toggleProps, + className: "wp-block-image__aspect-ratio" + }, _ref4 => { + let { + onClose + } = _ref4; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(AspectGroup, { + isDisabled: isInProgress, + onClick: newAspect => { + setAspect(newAspect); + onClose(); + }, + value: aspect, + aspectRatios: [{ + title: (0,external_wp_i18n_namespaceObject.__)('Original'), + aspect: defaultAspect + }, { + title: (0,external_wp_i18n_namespaceObject.__)('Square'), + aspect: 1 + }] + }), (0,external_wp_element_namespaceObject.createElement)(AspectGroup, { + label: (0,external_wp_i18n_namespaceObject.__)('Landscape'), + isDisabled: isInProgress, + onClick: newAspect => { + setAspect(newAspect); + onClose(); + }, + value: aspect, + aspectRatios: [{ + title: (0,external_wp_i18n_namespaceObject.__)('16:10'), + aspect: 16 / 10 + }, { + title: (0,external_wp_i18n_namespaceObject.__)('16:9'), + aspect: 16 / 9 + }, { + title: (0,external_wp_i18n_namespaceObject.__)('4:3'), + aspect: 4 / 3 + }, { + title: (0,external_wp_i18n_namespaceObject.__)('3:2'), + aspect: 3 / 2 + }] + }), (0,external_wp_element_namespaceObject.createElement)(AspectGroup, { + label: (0,external_wp_i18n_namespaceObject.__)('Portrait'), + isDisabled: isInProgress, + onClick: newAspect => { + setAspect(newAspect); + onClose(); + }, + value: aspect, + aspectRatios: [{ + title: (0,external_wp_i18n_namespaceObject.__)('10:16'), + aspect: 10 / 16 + }, { + title: (0,external_wp_i18n_namespaceObject.__)('9:16'), + aspect: 9 / 16 + }, { + title: (0,external_wp_i18n_namespaceObject.__)('3:4'), + aspect: 3 / 4 + }, { + title: (0,external_wp_i18n_namespaceObject.__)('2:3'), + aspect: 2 / 3 + }] + })); + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/rotate-right.js + + +/** + * WordPress dependencies + */ + +const rotateRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z" +})); +/* harmony default export */ var rotate_right = (rotateRight); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/rotation-button.js + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + +function RotationButton() { + const { + isInProgress, + rotateClockwise + } = useImageEditingContext(); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + icon: rotate_right, + label: (0,external_wp_i18n_namespaceObject.__)('Rotate'), + onClick: rotateClockwise, + disabled: isInProgress + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/form-controls.js + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +function FormControls() { + const { + isInProgress, + apply, + cancel + } = useImageEditingContext(); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + onClick: apply, + disabled: isInProgress + }, (0,external_wp_i18n_namespaceObject.__)('Apply')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + onClick: cancel + }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/index.js + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + + + + + +function ImageEditor(_ref) { + let { + url, + width, + height, + clientWidth, + naturalHeight, + naturalWidth + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(ImageCropper, { + url: url, + width: width, + height: height, + clientWidth: clientWidth, + naturalHeight: naturalHeight, + naturalWidth: naturalWidth + }), (0,external_wp_element_namespaceObject.createElement)(block_controls, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_wp_element_namespaceObject.createElement)(ZoomDropdown, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, null, toggleProps => (0,external_wp_element_namespaceObject.createElement)(AspectRatioDropdown, { + toggleProps: toggleProps + })), (0,external_wp_element_namespaceObject.createElement)(RotationButton, null)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_wp_element_namespaceObject.createElement)(FormControls, null)))); +} + + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-size-control/use-dimension-handler.js +/** + * WordPress dependencies + */ + +function useDimensionHandler(customHeight, customWidth, defaultHeight, defaultWidth, onChange) { + var _ref, _ref2; + + const [currentWidth, setCurrentWidth] = (0,external_wp_element_namespaceObject.useState)((_ref = customWidth !== null && customWidth !== void 0 ? customWidth : defaultWidth) !== null && _ref !== void 0 ? _ref : ''); + const [currentHeight, setCurrentHeight] = (0,external_wp_element_namespaceObject.useState)((_ref2 = customHeight !== null && customHeight !== void 0 ? customHeight : defaultHeight) !== null && _ref2 !== void 0 ? _ref2 : ''); // When an image is first inserted, the default dimensions are initially + // undefined. This effect updates the dimensions when the default values + // come through. + + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (customWidth === undefined && defaultWidth !== undefined) { + setCurrentWidth(defaultWidth); + } + + if (customHeight === undefined && defaultHeight !== undefined) { + setCurrentHeight(defaultHeight); + } + }, [defaultWidth, defaultHeight]); // If custom values change, it means an outsider has resized the image using some other method (eg resize box) + // this keeps track of these values too. We need to parse before comparing; custom values can be strings. + + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (customWidth !== undefined && Number.parseInt(customWidth) !== Number.parseInt(currentWidth)) { + setCurrentWidth(customWidth); + } + + if (customHeight !== undefined && Number.parseInt(customHeight) !== Number.parseInt(currentHeight)) { + setCurrentHeight(customHeight); + } + }, [customWidth, customHeight]); + + const updateDimension = (dimension, value) => { + if (dimension === 'width') { + setCurrentWidth(value); + } else { + setCurrentHeight(value); + } + + onChange({ + [dimension]: value === '' ? undefined : parseInt(value, 10) + }); + }; + + const updateDimensions = (nextHeight, nextWidth) => { + setCurrentHeight(nextHeight !== null && nextHeight !== void 0 ? nextHeight : defaultHeight); + setCurrentWidth(nextWidth !== null && nextWidth !== void 0 ? nextWidth : defaultWidth); + onChange({ + height: nextHeight, + width: nextWidth + }); + }; + + return { + currentHeight, + currentWidth, + updateDimension, + updateDimensions + }; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-size-control/index.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + +const IMAGE_SIZE_PRESETS = [25, 50, 75, 100]; +function ImageSizeControl(_ref) { + let { + imageWidth, + imageHeight, + imageSizeOptions = [], + isResizable = true, + slug, + width, + height, + onChange, + onChangeImage = external_lodash_namespaceObject.noop + } = _ref; + const { + currentHeight, + currentWidth, + updateDimension, + updateDimensions + } = useDimensionHandler(height, width, imageHeight, imageWidth, onChange); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, !(0,external_lodash_namespaceObject.isEmpty)(imageSizeOptions) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Image size'), + value: slug, + options: imageSizeOptions, + onChange: onChangeImage + }), isResizable && (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-image-size-control" + }, (0,external_wp_element_namespaceObject.createElement)("p", { + className: "block-editor-image-size-control__row" + }, (0,external_wp_i18n_namespaceObject.__)('Image dimensions')), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-image-size-control__row" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { + type: "number", + className: "block-editor-image-size-control__width", + label: (0,external_wp_i18n_namespaceObject.__)('Width'), + value: currentWidth, + min: 1, + onChange: value => updateDimension('width', value) + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { + type: "number", + className: "block-editor-image-size-control__height", + label: (0,external_wp_i18n_namespaceObject.__)('Height'), + value: currentHeight, + min: 1, + onChange: value => updateDimension('height', value) + })), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-image-size-control__row" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ButtonGroup, { + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Image size presets') + }, IMAGE_SIZE_PRESETS.map(scale => { + const scaledWidth = Math.round(imageWidth * (scale / 100)); + const scaledHeight = Math.round(imageHeight * (scale / 100)); + const isCurrent = currentWidth === scaledWidth && currentHeight === scaledHeight; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + key: scale, + isSmall: true, + variant: isCurrent ? 'primary' : undefined, + isPressed: isCurrent, + onClick: () => updateDimensions(scaledHeight, scaledWidth) + }, scale, "%"); + })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + isSmall: true, + onClick: () => updateDimensions() + }, (0,external_wp_i18n_namespaceObject.__)('Reset'))))); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/keyboard-return.js + + +/** + * WordPress dependencies + */ + +const keyboardReturn = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "-2 -2 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M6.734 16.106l2.176-2.38-1.093-1.028-3.846 4.158 3.846 4.157 1.093-1.027-2.176-2.38h2.811c1.125 0 2.25.03 3.374 0 1.428-.001 3.362-.25 4.963-1.277 1.66-1.065 2.868-2.906 2.868-5.859 0-2.479-1.327-4.896-3.65-5.93-1.82-.813-3.044-.8-4.806-.788l-.567.002v1.5c.184 0 .368 0 .553-.002 1.82-.007 2.704-.014 4.21.657 1.854.827 2.76 2.657 2.76 4.561 0 2.472-.973 3.824-2.178 4.596-1.258.807-2.864 1.04-4.163 1.04h-.02c-1.115.03-2.229 0-3.344 0H6.734z" +})); +/* harmony default export */ var keyboard_return = (keyboardReturn); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/settings-drawer.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + +const LinkControlSettingsDrawer = _ref => { + let { + value, + onChange = external_lodash_namespaceObject.noop, + settings + } = _ref; + + if (!settings || !settings.length) { + return null; + } + + const handleSettingChange = setting => newValue => { + onChange({ ...value, + [setting.id]: newValue + }); + }; + + const theSettings = settings.map(setting => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, { + className: "block-editor-link-control__setting", + key: setting.id, + label: setting.title, + onChange: handleSettingChange(setting), + checked: value ? !!value[setting.id] : false + })); + return (0,external_wp_element_namespaceObject.createElement)("fieldset", { + className: "block-editor-link-control__settings" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { + as: "legend" + }, (0,external_wp_i18n_namespaceObject.__)('Currently selected link settings')), theSettings); +}; + +/* harmony default export */ var settings_drawer = (LinkControlSettingsDrawer); + +// EXTERNAL MODULE: ./node_modules/dom-scroll-into-view/lib/index.js +var dom_scroll_into_view_lib = __webpack_require__(5425); +var lib_default = /*#__PURE__*/__webpack_require__.n(dom_scroll_into_view_lib); +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-input/index.js + + + +/** + * External dependencies + */ + + + +/** + * WordPress dependencies + */ + + + + + + + + +/** + * Internal dependencies + */ + + + +class URLInput extends external_wp_element_namespaceObject.Component { + constructor(props) { + super(props); + this.onChange = this.onChange.bind(this); + this.onFocus = this.onFocus.bind(this); + this.onKeyDown = this.onKeyDown.bind(this); + this.selectLink = this.selectLink.bind(this); + this.handleOnClick = this.handleOnClick.bind(this); + this.bindSuggestionNode = this.bindSuggestionNode.bind(this); + this.autocompleteRef = props.autocompleteRef || (0,external_wp_element_namespaceObject.createRef)(); + this.inputRef = (0,external_wp_element_namespaceObject.createRef)(); + this.updateSuggestions = (0,external_lodash_namespaceObject.debounce)(this.updateSuggestions.bind(this), 200); + this.suggestionNodes = []; + this.isUpdatingSuggestions = false; + this.state = { + suggestions: [], + showSuggestions: false, + selectedSuggestion: null, + suggestionsListboxId: '', + suggestionOptionIdPrefix: '' + }; + } + + componentDidUpdate(prevProps) { + const { + showSuggestions, + selectedSuggestion + } = this.state; + const { + value, + __experimentalShowInitialSuggestions = false + } = this.props; // Only have to worry about scrolling selected suggestion into view + // when already expanded. + + if (showSuggestions && selectedSuggestion !== null && this.suggestionNodes[selectedSuggestion] && !this.scrollingIntoView) { + this.scrollingIntoView = true; + lib_default()(this.suggestionNodes[selectedSuggestion], this.autocompleteRef.current, { + onlyScrollIfNeeded: true + }); + this.props.setTimeout(() => { + this.scrollingIntoView = false; + }, 100); + } // Update suggestions when the value changes. + + + if (prevProps.value !== value && !this.props.disableSuggestions && !this.isUpdatingSuggestions) { + if (value !== null && value !== void 0 && value.length) { + // If the new value is not empty we need to update with suggestions for it. + this.updateSuggestions(value); + } else if (__experimentalShowInitialSuggestions) { + // If the new value is empty and we can show initial suggestions, then show initial suggestions. + this.updateSuggestions(); + } + } + } + + componentDidMount() { + if (this.shouldShowInitialSuggestions()) { + this.updateSuggestions(); + } + } + + componentWillUnmount() { + var _this$suggestionsRequ, _this$suggestionsRequ2; + + (_this$suggestionsRequ = this.suggestionsRequest) === null || _this$suggestionsRequ === void 0 ? void 0 : (_this$suggestionsRequ2 = _this$suggestionsRequ.cancel) === null || _this$suggestionsRequ2 === void 0 ? void 0 : _this$suggestionsRequ2.call(_this$suggestionsRequ); + delete this.suggestionsRequest; + } + + bindSuggestionNode(index) { + return ref => { + this.suggestionNodes[index] = ref; + }; + } + + shouldShowInitialSuggestions() { + const { + suggestions + } = this.state; + const { + __experimentalShowInitialSuggestions = false, + value + } = this.props; + return !this.isUpdatingSuggestions && __experimentalShowInitialSuggestions && !(value && value.length) && !(suggestions && suggestions.length); + } + + updateSuggestions() { + var _value; + + let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + const { + __experimentalFetchLinkSuggestions: fetchLinkSuggestions, + __experimentalHandleURLSuggestions: handleURLSuggestions + } = this.props; + + if (!fetchLinkSuggestions) { + return; + } // Initial suggestions may only show if there is no value + // (note: this includes whitespace). + + + const isInitialSuggestions = !((_value = value) !== null && _value !== void 0 && _value.length); // Trim only now we've determined whether or not it originally had a "length" + // (even if that value was all whitespace). + + value = value.trim(); // Allow a suggestions request if: + // - there are at least 2 characters in the search input (except manual searches where + // search input length is not required to trigger a fetch) + // - this is a direct entry (eg: a URL) + + if (!isInitialSuggestions && (value.length < 2 || !handleURLSuggestions && (0,external_wp_url_namespaceObject.isURL)(value))) { + this.setState({ + showSuggestions: false, + selectedSuggestion: null, + loading: false + }); + return; + } + + this.isUpdatingSuggestions = true; + this.setState({ + selectedSuggestion: null, + loading: true + }); + const request = fetchLinkSuggestions(value, { + isInitialSuggestions + }); + request.then(suggestions => { + // 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 (this.suggestionsRequest !== request) { + return; + } + + this.setState({ + suggestions, + loading: false, + showSuggestions: !!suggestions.length + }); + + if (!!suggestions.length) { + this.props.debouncedSpeak((0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %s: number of results. */ + (0,external_wp_i18n_namespaceObject._n)('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', suggestions.length), suggestions.length), 'assertive'); + } else { + this.props.debouncedSpeak((0,external_wp_i18n_namespaceObject.__)('No results.'), 'assertive'); + } + + this.isUpdatingSuggestions = false; + }).catch(() => { + if (this.suggestionsRequest === request) { + this.setState({ + loading: false + }); + this.isUpdatingSuggestions = false; + } + }); // Note that this assignment is handled *before* the async search request + // as a Promise always resolves on the next tick of the event loop. + + this.suggestionsRequest = request; + } + + onChange(event) { + const inputValue = event.target.value; + this.props.onChange(inputValue); + + if (!this.props.disableSuggestions) { + this.updateSuggestions(inputValue); + } + } + + onFocus() { + const { + suggestions + } = this.state; + const { + disableSuggestions, + value + } = this.props; // When opening the link editor, if there's a value present, we want to load the suggestions pane with the results for this input search value + // Don't re-run the suggestions on focus if there are already suggestions present (prevents searching again when tabbing between the input and buttons) + + if (value && !disableSuggestions && !this.isUpdatingSuggestions && !(suggestions && suggestions.length)) { + // Ensure the suggestions are updated with the current input value. + this.updateSuggestions(value); + } + } + + onKeyDown(event) { + const { + showSuggestions, + selectedSuggestion, + suggestions, + loading + } = this.state; // 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 || !suggestions.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_wp_keycodes_namespaceObject.UP: + { + if (0 !== event.target.selectionStart) { + 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_wp_keycodes_namespaceObject.DOWN: + { + if (this.props.value.length !== event.target.selectionStart) { + event.preventDefault(); // Set the input caret to the last position. + + event.target.setSelectionRange(this.props.value.length, this.props.value.length); + } + + break; + } + // Submitting while loading should trigger onSubmit. + + case external_wp_keycodes_namespaceObject.ENTER: + { + if (this.props.onSubmit) { + this.props.onSubmit(null, event); + } + + break; + } + } + + return; + } + + const suggestion = this.state.suggestions[this.state.selectedSuggestion]; + + switch (event.keyCode) { + case external_wp_keycodes_namespaceObject.UP: + { + event.preventDefault(); + const previousIndex = !selectedSuggestion ? suggestions.length - 1 : selectedSuggestion - 1; + this.setState({ + selectedSuggestion: previousIndex + }); + break; + } + + case external_wp_keycodes_namespaceObject.DOWN: + { + event.preventDefault(); + const nextIndex = selectedSuggestion === null || selectedSuggestion === suggestions.length - 1 ? 0 : selectedSuggestion + 1; + this.setState({ + selectedSuggestion: nextIndex + }); + break; + } + + case external_wp_keycodes_namespaceObject.TAB: + { + if (this.state.selectedSuggestion !== null) { + this.selectLink(suggestion); // Announce a link has been selected when tabbing away from the input field. + + this.props.speak((0,external_wp_i18n_namespaceObject.__)('Link selected.')); + } + + break; + } + + case external_wp_keycodes_namespaceObject.ENTER: + { + if (this.state.selectedSuggestion !== null) { + this.selectLink(suggestion); + + if (this.props.onSubmit) { + this.props.onSubmit(suggestion, event); + } + } else if (this.props.onSubmit) { + this.props.onSubmit(null, event); + } + + break; + } + } + } + + selectLink(suggestion) { + this.props.onChange(suggestion.url, suggestion); + this.setState({ + selectedSuggestion: null, + showSuggestions: false + }); + } + + handleOnClick(suggestion) { + this.selectLink(suggestion); // Move focus to the input field when a link suggestion is clicked. + + this.inputRef.current.focus(); + } + + static getDerivedStateFromProps(_ref, _ref2) { + let { + value, + instanceId, + disableSuggestions, + __experimentalShowInitialSuggestions = false + } = _ref; + let { + showSuggestions + } = _ref2; + let shouldShowSuggestions = showSuggestions; + const hasValue = value && value.length; + + if (!__experimentalShowInitialSuggestions && !hasValue) { + shouldShowSuggestions = false; + } + + if (disableSuggestions === true) { + shouldShowSuggestions = false; + } + + return { + showSuggestions: shouldShowSuggestions, + suggestionsListboxId: `block-editor-url-input-suggestions-${instanceId}`, + suggestionOptionIdPrefix: `block-editor-url-input-suggestion-${instanceId}` + }; + } + + render() { + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, this.renderControl(), this.renderSuggestions()); + } + + renderControl() { + const { + label, + className, + isFullWidth, + instanceId, + placeholder = (0,external_wp_i18n_namespaceObject.__)('Paste URL or type to search'), + __experimentalRenderControl: renderControl, + value = '' + } = this.props; + const { + loading, + showSuggestions, + selectedSuggestion, + suggestionsListboxId, + suggestionOptionIdPrefix + } = this.state; + const controlProps = { + id: `url-input-control-${instanceId}`, + label, + className: classnames_default()('block-editor-url-input', className, { + 'is-full-width': isFullWidth + }) + }; + const inputProps = { + value, + required: true, + className: 'block-editor-url-input__input', + type: 'text', + onChange: this.onChange, + onFocus: this.onFocus, + placeholder, + onKeyDown: this.onKeyDown, + role: 'combobox', + 'aria-label': (0,external_wp_i18n_namespaceObject.__)('URL'), + 'aria-expanded': showSuggestions, + 'aria-autocomplete': 'list', + 'aria-owns': suggestionsListboxId, + 'aria-activedescendant': selectedSuggestion !== null ? `${suggestionOptionIdPrefix}-${selectedSuggestion}` : undefined, + ref: this.inputRef + }; + + if (renderControl) { + return renderControl(controlProps, inputProps, loading); + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, controlProps, (0,external_wp_element_namespaceObject.createElement)("input", inputProps), loading && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null)); + } + + renderSuggestions() { + const { + className, + __experimentalRenderSuggestions: renderSuggestions, + value = '', + __experimentalShowInitialSuggestions = false + } = this.props; + const { + showSuggestions, + suggestions, + selectedSuggestion, + suggestionsListboxId, + suggestionOptionIdPrefix, + loading + } = this.state; + const suggestionsListProps = { + id: suggestionsListboxId, + ref: this.autocompleteRef, + role: 'listbox' + }; + + const buildSuggestionItemProps = (suggestion, index) => { + return { + role: 'option', + tabIndex: '-1', + id: `${suggestionOptionIdPrefix}-${index}`, + ref: this.bindSuggestionNode(index), + 'aria-selected': index === selectedSuggestion + }; + }; + + if ((0,external_lodash_namespaceObject.isFunction)(renderSuggestions) && showSuggestions && !!suggestions.length) { + return renderSuggestions({ + suggestions, + selectedSuggestion, + suggestionsListProps, + buildSuggestionItemProps, + isLoading: loading, + handleSuggestionClick: this.handleOnClick, + isInitialSuggestions: __experimentalShowInitialSuggestions && !(value && value.length) + }); + } + + if (!(0,external_lodash_namespaceObject.isFunction)(renderSuggestions) && showSuggestions && !!suggestions.length) { + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, { + position: "bottom", + noArrow: true, + focusOnMount: false + }, (0,external_wp_element_namespaceObject.createElement)("div", _extends({}, suggestionsListProps, { + className: classnames_default()('block-editor-url-input__suggestions', `${className}__suggestions`) + }), suggestions.map((suggestion, index) => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({}, buildSuggestionItemProps(suggestion, index), { + key: suggestion.id, + className: classnames_default()('block-editor-url-input__suggestion', { + 'is-selected': index === selectedSuggestion + }), + onClick: () => this.handleOnClick(suggestion) + }), suggestion.title)))); + } + + return null; + } + +} +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-input/README.md + */ + + +/* harmony default export */ var url_input = ((0,external_wp_compose_namespaceObject.compose)(external_wp_compose_namespaceObject.withSafeTimeout, external_wp_components_namespaceObject.withSpokenMessages, external_wp_compose_namespaceObject.withInstanceId, (0,external_wp_data_namespaceObject.withSelect)((select, props) => { + // If a link suggestions handler is already provided then + // bail. + if ((0,external_lodash_namespaceObject.isFunction)(props.__experimentalFetchLinkSuggestions)) { + return; + } + + const { + getSettings + } = select(store); + return { + __experimentalFetchLinkSuggestions: getSettings().__experimentalFetchLinkSuggestions + }; +}))(URLInput)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-create-button.js + + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + +const LinkControlSearchCreate = _ref => { + let { + searchTerm, + onClick, + itemProps, + isSelected, + buttonText + } = _ref; + + if (!searchTerm) { + return null; + } + + let text; + + if (buttonText) { + text = (0,external_lodash_namespaceObject.isFunction)(buttonText) ? buttonText(searchTerm) : buttonText; + } else { + text = (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %s: search term. */ + (0,external_wp_i18n_namespaceObject.__)('Create: %s'), searchTerm), { + mark: (0,external_wp_element_namespaceObject.createElement)("mark", null) + }); + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({}, itemProps, { + className: classnames_default()('block-editor-link-control__search-create block-editor-link-control__search-item', { + 'is-selected': isSelected + }), + onClick: onClick + }), (0,external_wp_element_namespaceObject.createElement)(build_module_icon, { + className: "block-editor-link-control__search-item-icon", + icon: library_plus + }), (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-link-control__search-item-header" + }, (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-link-control__search-item-title" + }, text))); +}; +/* harmony default export */ var search_create_button = (LinkControlSearchCreate); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/globe.js + + +/** + * WordPress dependencies + */ + +const globe = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M12 3.3c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z" +})); +/* harmony default export */ var library_globe = (globe); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-item.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + +const LinkControlSearchItem = _ref => { + let { + itemProps, + suggestion, + isSelected = false, + onClick, + isURL = false, + searchTerm = '', + shouldShowType = false + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({}, itemProps, { + onClick: onClick, + className: classnames_default()('block-editor-link-control__search-item', { + 'is-selected': isSelected, + 'is-url': isURL, + 'is-entity': !isURL + }) + }), isURL && (0,external_wp_element_namespaceObject.createElement)(build_module_icon, { + className: "block-editor-link-control__search-item-icon", + icon: library_globe + }), (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-link-control__search-item-header" + }, (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-link-control__search-item-title" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextHighlight, { + text: suggestion.title, + highlight: searchTerm + })), (0,external_wp_element_namespaceObject.createElement)("span", { + "aria-hidden": !isURL, + className: "block-editor-link-control__search-item-info" + }, !isURL && ((0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURI)(suggestion.url)) || ''), isURL && (0,external_wp_i18n_namespaceObject.__)('Press ENTER to add this link'))), shouldShowType && suggestion.type && (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-link-control__search-item-type" + }, getVisualTypeName(suggestion))); +}; + +function getVisualTypeName(suggestion) { + if (suggestion.isFrontPage) { + return 'front page'; + } // Rename 'post_tag' to 'tag'. Ideally, the API would return the localised CPT or taxonomy label. + + + return suggestion.type === 'post_tag' ? 'tag' : suggestion.type; +} + +/* harmony default export */ var search_item = (LinkControlSearchItem); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/constants.js +/** + * WordPress dependencies + */ + // Used as a unique identifier for the "Create" option within search results. +// Used to help distinguish the "Create" suggestion within the search results in +// order to handle it as a unique case. + +const CREATE_TYPE = '__CREATE__'; +const DEFAULT_LINK_SETTINGS = [{ + id: 'opensInNewTab', + title: (0,external_wp_i18n_namespaceObject.__)('Open in new tab') +}]; + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-results.js + + +/** + * WordPress dependencies + */ + + +/** + * External dependencies + */ + + + +/** + * Internal dependencies + */ + + + + +function LinkControlSearchResults(_ref) { + let { + instanceId, + withCreateSuggestion, + currentInputValue, + handleSuggestionClick, + suggestionsListProps, + buildSuggestionItemProps, + suggestions, + selectedSuggestion, + isLoading, + isInitialSuggestions, + createSuggestionButtonText, + suggestionsQuery + } = _ref; + const resultsListClasses = classnames_default()('block-editor-link-control__search-results', { + 'is-loading': isLoading + }); + const directLinkEntryTypes = ['url', 'mailto', 'tel', 'internal']; + const isSingleDirectEntryResult = suggestions.length === 1 && directLinkEntryTypes.includes(suggestions[0].type.toLowerCase()); + const shouldShowCreateSuggestion = withCreateSuggestion && !isSingleDirectEntryResult && !isInitialSuggestions; // If the query has a specified type, then we can skip showing them in the result. See #24839. + + const shouldShowSuggestionsTypes = !(suggestionsQuery !== null && suggestionsQuery !== void 0 && suggestionsQuery.type); // According to guidelines aria-label should be added if the label + // itself is not visible. + // See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role + + const searchResultsLabelId = `block-editor-link-control-search-results-label-${instanceId}`; + const labelText = isInitialSuggestions ? (0,external_wp_i18n_namespaceObject.__)('Recently updated') : (0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %s: search term. */ + (0,external_wp_i18n_namespaceObject.__)('Search results for "%s"'), currentInputValue); // VisuallyHidden rightly doesn't accept custom classNames + // so we conditionally render it as a wrapper to visually hide the label + // when that is required. + + const searchResultsLabel = (0,external_wp_element_namespaceObject.createElement)(isInitialSuggestions ? external_wp_element_namespaceObject.Fragment : external_wp_components_namespaceObject.VisuallyHidden, {}, // Empty props. + (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-link-control__search-results-label", + id: searchResultsLabelId + }, labelText)); + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-link-control__search-results-wrapper" + }, searchResultsLabel, (0,external_wp_element_namespaceObject.createElement)("div", _extends({}, suggestionsListProps, { + className: resultsListClasses, + "aria-labelledby": searchResultsLabelId + }), suggestions.map((suggestion, index) => { + if (shouldShowCreateSuggestion && CREATE_TYPE === suggestion.type) { + return (0,external_wp_element_namespaceObject.createElement)(search_create_button, { + searchTerm: currentInputValue, + buttonText: createSuggestionButtonText, + onClick: () => handleSuggestionClick(suggestion) // Intentionally only using `type` here as + // the constant is enough to uniquely + // identify the single "CREATE" suggestion. + , + key: suggestion.type, + itemProps: buildSuggestionItemProps(suggestion, index), + isSelected: index === selectedSuggestion + }); + } // If we're not handling "Create" suggestions above then + // we don't want them in the main results so exit early. + + + if (CREATE_TYPE === suggestion.type) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)(search_item, { + key: `${suggestion.id}-${suggestion.type}`, + itemProps: buildSuggestionItemProps(suggestion, index), + suggestion: suggestion, + index: index, + onClick: () => { + handleSuggestionClick(suggestion); + }, + isSelected: index === selectedSuggestion, + isURL: directLinkEntryTypes.includes(suggestion.type.toLowerCase()), + searchTerm: currentInputValue, + shouldShowType: shouldShowSuggestionsTypes, + isFrontPage: suggestion === null || suggestion === void 0 ? void 0 : suggestion.isFrontPage + }); + }))); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/is-url-like.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +/** + * Determines whether a given value could be a URL. Note this does not + * guarantee the value is a URL only that it looks like it might be one. For + * example, just because a string has `www.` in it doesn't make it a URL, + * but it does make it highly likely that it will be so in the context of + * creating a link it makes sense to treat it like one. + * + * @param {string} val the candidate for being URL-like (or not). + * + * @return {boolean} whether or not the value is potentially a URL. + */ + +function isURLLike(val) { + const isInternal = (0,external_lodash_namespaceObject.startsWith)(val, '#'); + return (0,external_wp_url_namespaceObject.isURL)(val) || val && val.includes('www.') || isInternal; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-search-handler.js +/** + * WordPress dependencies + */ + + + +/** + * External dependencies + */ + + +/** + * Internal dependencies + */ + + + + +const handleNoop = () => Promise.resolve([]); +const handleDirectEntry = val => { + let type = 'URL'; + const protocol = (0,external_wp_url_namespaceObject.getProtocol)(val) || ''; + + if (protocol.includes('mailto')) { + type = 'mailto'; + } + + if (protocol.includes('tel')) { + type = 'tel'; + } + + if ((0,external_lodash_namespaceObject.startsWith)(val, '#')) { + type = 'internal'; + } + + return Promise.resolve([{ + id: val, + title: val, + url: type === 'URL' ? (0,external_wp_url_namespaceObject.prependHTTP)(val) : val, + type + }]); +}; + +const handleEntitySearch = async (val, suggestionsQuery, fetchSearchSuggestions, directEntryHandler, withCreateSuggestion, withURLSuggestion, pageOnFront) => { + const { + isInitialSuggestions + } = suggestionsQuery; + let resultsIncludeFrontPage = false; + let results = await Promise.all([fetchSearchSuggestions(val, suggestionsQuery), directEntryHandler(val)]); // Identify front page and update type to match. + + results[0] = results[0].map(result => { + if (Number(result.id) === pageOnFront) { + resultsIncludeFrontPage = true; + result.isFrontPage = true; + return result; + } + + return result; + }); + const couldBeURL = !val.includes(' '); // If it's potentially a URL search then concat on a URL search suggestion + // just for good measure. That way once the actual results run out we always + // have a URL option to fallback on. + + if (!resultsIncludeFrontPage && couldBeURL && withURLSuggestion && !isInitialSuggestions) { + results = results[0].concat(results[1]); + } else { + results = results[0]; + } // If displaying initial suggestions just return plain results. + + + if (isInitialSuggestions) { + return results; + } // Here we append a faux suggestion to represent a "CREATE" option. This + // is detected in the rendering of the search results and handled as a + // special case. This is currently necessary because the suggestions + // dropdown will only appear if there are valid suggestions and + // therefore unless the create option is a suggestion it will not + // display in scenarios where there are no results returned from the + // API. In addition promoting CREATE to a first class suggestion affords + // the a11y benefits afforded by `URLInput` to all suggestions (eg: + // keyboard handling, ARIA roles...etc). + // + // Note also that the value of the `title` and `url` properties must correspond + // to the text value of the ``. This is because `title` is used + // when creating the suggestion. Similarly `url` is used when using keyboard to select + // the suggestion (the `onSubmit` handler falls-back to `url`). + + + return isURLLike(val) || !withCreateSuggestion ? results : results.concat({ + // the `id` prop is intentionally ommitted here because it + // is never exposed as part of the component's public API. + // see: https://github.com/WordPress/gutenberg/pull/19775#discussion_r378931316. + title: val, + // Must match the existing ``s text value. + url: val, + // Must match the existing ``s text value. + type: CREATE_TYPE + }); +}; + +function useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggestion, withURLSuggestion) { + const { + fetchSearchSuggestions, + pageOnFront + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getSettings + } = select(store); + return { + pageOnFront: getSettings().pageOnFront, + fetchSearchSuggestions: getSettings().__experimentalFetchLinkSuggestions + }; + }, []); + const directEntryHandler = allowDirectEntry ? handleDirectEntry : handleNoop; + return (0,external_wp_element_namespaceObject.useCallback)((val, _ref) => { + let { + isInitialSuggestions + } = _ref; + return isURLLike(val) ? directEntryHandler(val, { + isInitialSuggestions + }) : handleEntitySearch(val, { ...suggestionsQuery, + isInitialSuggestions + }, fetchSearchSuggestions, directEntryHandler, withCreateSuggestion, withURLSuggestion, pageOnFront); + }, [directEntryHandler, fetchSearchSuggestions, withCreateSuggestion]); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-input.js + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + + // Must be a function as otherwise URLInput will default +// to the fetchLinkSuggestions passed in block editor settings +// which will cause an unintended http request. + +const noopSearchHandler = () => Promise.resolve([]); + +const LinkControlSearchInput = (0,external_wp_element_namespaceObject.forwardRef)((_ref, ref) => { + let { + value, + children, + currentLink = {}, + className = null, + placeholder = null, + withCreateSuggestion = false, + onCreateSuggestion = external_lodash_namespaceObject.noop, + onChange = external_lodash_namespaceObject.noop, + onSelect = external_lodash_namespaceObject.noop, + showSuggestions = true, + renderSuggestions = props => (0,external_wp_element_namespaceObject.createElement)(LinkControlSearchResults, props), + fetchSuggestions = null, + allowDirectEntry = true, + showInitialSuggestions = false, + suggestionsQuery = {}, + withURLSuggestion = true, + createSuggestionButtonText, + useLabel = false + } = _ref; + const genericSearchHandler = useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggestion, withURLSuggestion); + const searchHandler = showSuggestions ? fetchSuggestions || genericSearchHandler : noopSearchHandler; + const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(LinkControlSearchInput); + const [focusedSuggestion, setFocusedSuggestion] = (0,external_wp_element_namespaceObject.useState)(); + /** + * Handles the user moving between different suggestions. Does not handle + * choosing an individual item. + * + * @param {string} selection the url of the selected suggestion. + * @param {Object} suggestion the suggestion object. + */ + + const onInputChange = (selection, suggestion) => { + onChange(selection); + setFocusedSuggestion(suggestion); + }; + + const handleRenderSuggestions = props => renderSuggestions({ ...props, + instanceId, + withCreateSuggestion, + currentInputValue: value, + createSuggestionButtonText, + suggestionsQuery, + handleSuggestionClick: suggestion => { + if (props.handleSuggestionClick) { + props.handleSuggestionClick(suggestion); + } + + onSuggestionSelected(suggestion); + } + }); + + const onSuggestionSelected = async selectedSuggestion => { + let suggestion = selectedSuggestion; + + if (CREATE_TYPE === selectedSuggestion.type) { + // Create a new page and call onSelect with the output from the onCreateSuggestion callback. + try { + var _suggestion; + + suggestion = await onCreateSuggestion(selectedSuggestion.title); + + if ((_suggestion = suggestion) !== null && _suggestion !== void 0 && _suggestion.url) { + onSelect(suggestion); + } + } catch (e) {} + + return; + } + + if (allowDirectEntry || suggestion && Object.keys(suggestion).length >= 1) { + onSelect( // Some direct entries don't have types or IDs, and we still need to clear the previous ones. + { ...(0,external_lodash_namespaceObject.omit)(currentLink, 'id', 'url'), + ...suggestion + }, suggestion); + } + }; + + const inputClasses = classnames_default()(className, { + 'has-no-label': !useLabel + }); + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-link-control__search-input-container" + }, (0,external_wp_element_namespaceObject.createElement)(url_input, { + label: useLabel ? 'URL' : undefined, + className: inputClasses, + value: value, + onChange: onInputChange, + placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : (0,external_wp_i18n_namespaceObject.__)('Search or type url'), + __experimentalRenderSuggestions: showSuggestions ? handleRenderSuggestions : null, + __experimentalFetchLinkSuggestions: searchHandler, + __experimentalHandleURLSuggestions: true, + __experimentalShowInitialSuggestions: showInitialSuggestions, + onSubmit: (suggestion, event) => { + var _value$trim; + + const hasSuggestion = suggestion || focusedSuggestion; // If there is no suggestion and the value (ie: any manually entered URL) is empty + // then don't allow submission otherwise we get empty links. + + if (!hasSuggestion && !(value !== null && value !== void 0 && (_value$trim = value.trim()) !== null && _value$trim !== void 0 && _value$trim.length)) { + event.preventDefault(); + } else { + onSuggestionSelected(hasSuggestion || { + url: value + }); + } + }, + ref: ref + }), children); +}); +/* harmony default export */ var search_input = (LinkControlSearchInput); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/info.js + + +/** + * WordPress dependencies + */ + +const info = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z" +})); +/* harmony default export */ var library_info = (info); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pencil.js + + +/** + * WordPress dependencies + */ + +const pencil = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z" +})); +/* harmony default export */ var library_pencil = (pencil); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js +/** + * Internal dependencies + */ + +/* harmony default export */ var library_edit = (library_pencil); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/viewer-slot.js +/** + * WordPress dependencies + */ + +const { + Slot: ViewerSlot, + Fill: ViewerFill +} = (0,external_wp_components_namespaceObject.createSlotFill)('BlockEditorLinkControlViewer'); + +/* harmony default export */ var viewer_slot = ((/* unused pure expression or super */ null && (ViewerSlot))); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-rich-url-data.js +/** + * Internal dependencies + */ + +/** + * WordPress dependencies + */ + + + + +function use_rich_url_data_reducer(state, action) { + switch (action.type) { + case 'RESOLVED': + return { ...state, + isFetching: false, + richData: action.richData + }; + + case 'ERROR': + return { ...state, + isFetching: false, + richData: null + }; + + case 'LOADING': + return { ...state, + isFetching: true + }; + + default: + throw new Error(`Unexpected action type ${action.type}`); + } +} + +function useRemoteUrlData(url) { + const [state, dispatch] = (0,external_wp_element_namespaceObject.useReducer)(use_rich_url_data_reducer, { + richData: null, + isFetching: false + }); + const { + fetchRichUrlData + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getSettings + } = select(store); + return { + fetchRichUrlData: getSettings().__experimentalFetchRichUrlData + }; + }, []); + (0,external_wp_element_namespaceObject.useEffect)(() => { + // Only make the request if we have an actual URL + // and the fetching util is available. In some editors + // there may not be such a util. + if (url !== null && url !== void 0 && url.length && fetchRichUrlData && typeof AbortController !== 'undefined') { + dispatch({ + type: 'LOADING' + }); + const controller = new window.AbortController(); + const signal = controller.signal; + fetchRichUrlData(url, { + signal + }).then(urlData => { + dispatch({ + type: 'RESOLVED', + richData: urlData + }); + }).catch(() => { + // Avoid setting state on unmounted component + if (!signal.aborted) { + dispatch({ + type: 'ERROR' + }); + } + }); // Cleanup: when the URL changes the abort the current request. + + return () => { + controller.abort(); + }; + } + }, [url]); + return state; +} + +/* harmony default export */ var use_rich_url_data = (useRemoteUrlData); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/link-preview.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + +function LinkPreview(_ref) { + var _value$url; + + let { + value, + onEditClick, + hasRichPreviews = false, + hasUnlinkControl = false, + onRemove + } = _ref; + // Avoid fetching if rich previews are not desired. + const showRichPreviews = hasRichPreviews ? value === null || value === void 0 ? void 0 : value.url : null; + const { + richData, + isFetching + } = use_rich_url_data(showRichPreviews); // Rich data may be an empty object so test for that. + + const hasRichData = richData && Object.keys(richData).length; + const displayURL = value && (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURI)(value.url), 16) || ''; + const displayTitle = (richData === null || richData === void 0 ? void 0 : richData.title) || (value === null || value === void 0 ? void 0 : value.title) || displayURL; // url can be undefined if the href attribute is unset + + const isEmptyURL = !(value !== null && value !== void 0 && (_value$url = value.url) !== null && _value$url !== void 0 && _value$url.length); + let icon; + + if (richData !== null && richData !== void 0 && richData.icon) { + icon = (0,external_wp_element_namespaceObject.createElement)("img", { + src: richData === null || richData === void 0 ? void 0 : richData.icon, + alt: "" + }); + } else if (isEmptyURL) { + icon = (0,external_wp_element_namespaceObject.createElement)(build_module_icon, { + icon: library_info, + size: 32 + }); + } else { + icon = (0,external_wp_element_namespaceObject.createElement)(build_module_icon, { + icon: library_globe + }); + } + + return (0,external_wp_element_namespaceObject.createElement)("div", { + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Currently selected'), + "aria-selected": "true", + className: classnames_default()('block-editor-link-control__search-item', { + 'is-current': true, + 'is-rich': hasRichData, + 'is-fetching': !!isFetching, + 'is-preview': true, + 'is-error': isEmptyURL + }) + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-link-control__search-item-top" + }, (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-link-control__search-item-header" + }, (0,external_wp_element_namespaceObject.createElement)("span", { + className: classnames_default()('block-editor-link-control__search-item-icon', { + 'is-image': richData === null || richData === void 0 ? void 0 : richData.icon + }) + }, icon), (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-link-control__search-item-details" + }, !isEmptyURL ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { + className: "block-editor-link-control__search-item-title", + href: value.url + }, (0,external_wp_dom_namespaceObject.__unstableStripHTML)(displayTitle)), (value === null || value === void 0 ? void 0 : value.url) && (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-link-control__search-item-info" + }, displayURL)) : (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-link-control__search-item-error-notice" + }, (0,external_wp_i18n_namespaceObject.__)('Link is empty')))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + icon: library_edit, + label: (0,external_wp_i18n_namespaceObject.__)('Edit'), + className: "block-editor-link-control__search-item-action", + onClick: onEditClick, + iconSize: 24 + }), hasUnlinkControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + icon: link_off, + label: (0,external_wp_i18n_namespaceObject.__)('Unlink'), + className: "block-editor-link-control__search-item-action block-editor-link-control__unlink", + onClick: onRemove, + iconSize: 24 + }), (0,external_wp_element_namespaceObject.createElement)(ViewerSlot, { + fillProps: value + })), (hasRichData && ((richData === null || richData === void 0 ? void 0 : richData.image) || (richData === null || richData === void 0 ? void 0 : richData.description)) || isFetching) && (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-link-control__search-item-bottom" + }, ((richData === null || richData === void 0 ? void 0 : richData.image) || isFetching) && (0,external_wp_element_namespaceObject.createElement)("div", { + "aria-hidden": !(richData !== null && richData !== void 0 && richData.image), + className: classnames_default()('block-editor-link-control__search-item-image', { + 'is-placeholder': !(richData !== null && richData !== void 0 && richData.image) + }) + }, (richData === null || richData === void 0 ? void 0 : richData.image) && (0,external_wp_element_namespaceObject.createElement)("img", { + src: richData === null || richData === void 0 ? void 0 : richData.image, + alt: "" + })), ((richData === null || richData === void 0 ? void 0 : richData.description) || isFetching) && (0,external_wp_element_namespaceObject.createElement)("div", { + "aria-hidden": !(richData !== null && richData !== void 0 && richData.description), + className: classnames_default()('block-editor-link-control__search-item-description', { + 'is-placeholder': !(richData !== null && richData !== void 0 && richData.description) + }) + }, (richData === null || richData === void 0 ? void 0 : richData.description) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, { + truncate: true, + numberOfLines: "2" + }, richData.description)))); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-create-page.js +/** + * WordPress dependencies + */ + + +function useCreatePage(handleCreatePage) { + const cancelableCreateSuggestion = (0,external_wp_element_namespaceObject.useRef)(); + const [isCreatingPage, setIsCreatingPage] = (0,external_wp_element_namespaceObject.useState)(false); + const [errorMessage, setErrorMessage] = (0,external_wp_element_namespaceObject.useState)(null); + + const createPage = async function (suggestionTitle) { + setIsCreatingPage(true); + setErrorMessage(null); + + try { + // Make cancellable in order that we can avoid setting State + // if the component unmounts during the call to `createSuggestion` + cancelableCreateSuggestion.current = makeCancelable( // Using Promise.resolve to allow createSuggestion to return a + // non-Promise based value. + Promise.resolve(handleCreatePage(suggestionTitle))); + return await cancelableCreateSuggestion.current.promise; + } catch (error) { + if (error && error.isCanceled) { + return; // bail if canceled to avoid setting state + } + + setErrorMessage(error.message || (0,external_wp_i18n_namespaceObject.__)('An unknown error occurred during creation. Please try again.')); + throw error; + } finally { + setIsCreatingPage(false); + } + }; + /** + * Handles cancelling any pending Promises that have been made cancelable. + */ + + + (0,external_wp_element_namespaceObject.useEffect)(() => { + return () => { + // componentDidUnmount + if (cancelableCreateSuggestion.current) { + cancelableCreateSuggestion.current.cancel(); + } + }; + }, []); + return { + createPage, + isCreatingPage, + errorMessage + }; +} +/** + * Creates a wrapper around a promise which allows it to be programmatically + * cancelled. + * See: https://reactjs.org/blog/2015/12/16/ismounted-antipattern.html + * + * @param {Promise} promise the Promise to make cancelable + */ + +const makeCancelable = promise => { + let hasCanceled_ = false; + const wrappedPromise = new Promise((resolve, reject) => { + promise.then(val => hasCanceled_ ? reject({ + isCanceled: true + }) : resolve(val), error => hasCanceled_ ? reject({ + isCanceled: true + }) : reject(error)); + }); + return { + promise: wrappedPromise, + + cancel() { + hasCanceled_ = true; + } + + }; +}; + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/index.js + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + + + +/** + * Internal dependencies + */ + + + + + + + +/** + * Default properties associated with a link control value. + * + * @typedef WPLinkControlDefaultValue + * + * @property {string} url Link URL. + * @property {string=} title Link title. + * @property {boolean=} opensInNewTab Whether link should open in a new browser + * tab. This value is only assigned if not + * providing a custom `settings` prop. + */ + +/* eslint-disable jsdoc/valid-types */ + +/** + * Custom settings values associated with a link. + * + * @typedef {{[setting:string]:any}} WPLinkControlSettingsValue + */ + +/* eslint-enable */ + +/** + * Custom settings values associated with a link. + * + * @typedef WPLinkControlSetting + * + * @property {string} id Identifier to use as property for setting value. + * @property {string} title Human-readable label to show in user interface. + */ + +/** + * Properties associated with a link control value, composed as a union of the + * default properties and any custom settings values. + * + * @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue + */ + +/** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */ + +/** + * Properties associated with a search suggestion used within the LinkControl. + * + * @typedef WPLinkControlSuggestion + * + * @property {string} id Identifier to use to uniquely identify the suggestion. + * @property {string} type Identifies the type of the suggestion (eg: `post`, + * `page`, `url`...etc) + * @property {string} title Human-readable label to show in user interface. + * @property {string} url A URL for the suggestion. + */ + +/** @typedef {(title:string)=>WPLinkControlSuggestion} WPLinkControlCreateSuggestionProp */ + +/** + * @typedef WPLinkControlProps + * + * @property {(WPLinkControlSetting[])=} settings An array of settings objects. Each object will used to + * render a `ToggleControl` for that setting. + * @property {boolean=} forceIsEditingLink If passed as either `true` or `false`, controls the + * internal editing state of the component to respective + * show or not show the URL input field. + * @property {WPLinkControlValue=} value Current link value. + * @property {WPLinkControlOnChangeProp=} onChange Value change handler, called with the updated value if + * the user selects a new link or updates settings. + * @property {boolean=} noDirectEntry Whether to allow turning a URL-like search query directly into a link. + * @property {boolean=} showSuggestions Whether to present suggestions when typing the URL. + * @property {boolean=} showInitialSuggestions Whether to present initial suggestions immediately. + * @property {boolean=} withCreateSuggestion Whether to allow creation of link value from suggestion. + * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions. + * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL. + * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion. + * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component. + */ + +/** + * Renders a link control. A link control is a controlled input which maintains + * a value associated with a link (HTML anchor element) and relevant settings + * for how that link is expected to behave. + * + * @param {WPLinkControlProps} props Component props. + */ + +function LinkControl(_ref) { + var _currentInputValue$tr, _value$url, _value$url$trim; + + let { + searchInputPlaceholder, + value, + settings = DEFAULT_LINK_SETTINGS, + onChange = external_lodash_namespaceObject.noop, + onRemove, + noDirectEntry = false, + showSuggestions = true, + showInitialSuggestions, + forceIsEditingLink, + createSuggestion, + withCreateSuggestion, + inputValue: propInputValue = '', + suggestionsQuery = {}, + noURLSuggestion = false, + createSuggestionButtonText, + hasRichPreviews = false, + hasTextControl = false, + renderControlBottom = null + } = _ref; + + if (withCreateSuggestion === undefined && createSuggestion) { + withCreateSuggestion = true; + } + + const isMounting = (0,external_wp_element_namespaceObject.useRef)(true); + const wrapperNode = (0,external_wp_element_namespaceObject.useRef)(); + const textInputRef = (0,external_wp_element_namespaceObject.useRef)(); + const [internalInputValue, setInternalInputValue] = (0,external_wp_element_namespaceObject.useState)((value === null || value === void 0 ? void 0 : value.url) || ''); + const [internalTextValue, setInternalTextValue] = (0,external_wp_element_namespaceObject.useState)((value === null || value === void 0 ? void 0 : value.title) || ''); + const currentInputValue = propInputValue || internalInputValue; + const [isEditingLink, setIsEditingLink] = (0,external_wp_element_namespaceObject.useState)(forceIsEditingLink !== undefined ? forceIsEditingLink : !value || !value.url); + const isEndingEditWithFocus = (0,external_wp_element_namespaceObject.useRef)(false); + const currentInputIsEmpty = !(currentInputValue !== null && currentInputValue !== void 0 && (_currentInputValue$tr = currentInputValue.trim()) !== null && _currentInputValue$tr !== void 0 && _currentInputValue$tr.length); + const { + createPage, + isCreatingPage, + errorMessage + } = useCreatePage(createSuggestion); + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (forceIsEditingLink !== undefined && forceIsEditingLink !== isEditingLink) { + setIsEditingLink(forceIsEditingLink); + } + }, [forceIsEditingLink]); + (0,external_wp_element_namespaceObject.useEffect)(() => { + // We don't auto focus into the Link UI on mount + // because otherwise using the keyboard to select text + // *within* the link format is not possible. + if (isMounting.current) { + isMounting.current = false; + return; + } // Unless we are mounting, we always want to focus either: + // - the URL input + // - the first focusable element in the Link UI. + // But in editing mode if there is a text input present then + // the URL input is at index 1. If not then it is at index 0. + + + const whichFocusTargetIndex = textInputRef !== null && textInputRef !== void 0 && textInputRef.current ? 1 : 0; // Scenario - when: + // - switching between editable and non editable LinkControl + // - clicking on a link + // ...then move focus to the *first* element to avoid focus loss + // and to ensure focus is *within* the Link UI. + + const nextFocusTarget = external_wp_dom_namespaceObject.focus.focusable.find(wrapperNode.current)[whichFocusTargetIndex] || wrapperNode.current; + nextFocusTarget.focus(); + isEndingEditWithFocus.current = false; + }, [isEditingLink, isCreatingPage]); + (0,external_wp_element_namespaceObject.useEffect)(() => { + /** + * If the value's `text` property changes then sync this + * back up with state. + */ + if (value !== null && value !== void 0 && value.title && value.title !== internalTextValue) { + setInternalTextValue(value.title); + } + /** + * Update the state value internalInputValue if the url value changes + * for example when clicking on another anchor + */ + + + if (value !== null && value !== void 0 && value.url) { + setInternalInputValue(value.url); + } + }, [value]); + /** + * Cancels editing state and marks that focus may need to be restored after + * the next render, if focus was within the wrapper when editing finished. + */ + + function stopEditing() { + var _wrapperNode$current; + + isEndingEditWithFocus.current = !!((_wrapperNode$current = wrapperNode.current) !== null && _wrapperNode$current !== void 0 && _wrapperNode$current.contains(wrapperNode.current.ownerDocument.activeElement)); + setIsEditingLink(false); + } + + const handleSelectSuggestion = updatedValue => { + onChange({ ...updatedValue, + title: internalTextValue || (updatedValue === null || updatedValue === void 0 ? void 0 : updatedValue.title) + }); + stopEditing(); + }; + + const handleSubmit = () => { + if (currentInputValue !== (value === null || value === void 0 ? void 0 : value.url) || internalTextValue !== (value === null || value === void 0 ? void 0 : value.title)) { + onChange({ + url: currentInputValue, + title: internalTextValue + }); + } + + stopEditing(); + }; + + const handleSubmitWithEnter = event => { + const { + keyCode + } = event; + + if (keyCode === external_wp_keycodes_namespaceObject.ENTER && !currentInputIsEmpty // Disallow submitting empty values. + ) { + event.preventDefault(); + handleSubmit(); + } + }; + + const shownUnlinkControl = onRemove && value && !isEditingLink && !isCreatingPage; + const showSettingsDrawer = !!(settings !== null && settings !== void 0 && settings.length); // Only show text control once a URL value has been committed + // and it isn't just empty whitespace. + // See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927. + + const showTextControl = (value === null || value === void 0 ? void 0 : (_value$url = value.url) === null || _value$url === void 0 ? void 0 : (_value$url$trim = _value$url.trim()) === null || _value$url$trim === void 0 ? void 0 : _value$url$trim.length) > 0 && hasTextControl; + return (0,external_wp_element_namespaceObject.createElement)("div", { + tabIndex: -1, + ref: wrapperNode, + className: "block-editor-link-control" + }, isCreatingPage && (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-link-control__loading" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), " ", (0,external_wp_i18n_namespaceObject.__)('Creating'), "\u2026"), (isEditingLink || !value) && !isCreatingPage && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { + className: classnames_default()({ + 'block-editor-link-control__search-input-wrapper': true, + 'has-text-control': showTextControl + }) + }, showTextControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { + ref: textInputRef, + className: "block-editor-link-control__field block-editor-link-control__text-content", + label: "Text", + value: internalTextValue, + onChange: setInternalTextValue, + onKeyDown: handleSubmitWithEnter + }), (0,external_wp_element_namespaceObject.createElement)(search_input, { + currentLink: value, + className: "block-editor-link-control__field block-editor-link-control__search-input", + placeholder: searchInputPlaceholder, + value: currentInputValue, + withCreateSuggestion: withCreateSuggestion, + onCreateSuggestion: createPage, + onChange: setInternalInputValue, + onSelect: handleSelectSuggestion, + showInitialSuggestions: showInitialSuggestions, + allowDirectEntry: !noDirectEntry, + showSuggestions: showSuggestions, + suggestionsQuery: suggestionsQuery, + withURLSuggestion: !noURLSuggestion, + createSuggestionButtonText: createSuggestionButtonText, + useLabel: showTextControl + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-link-control__search-actions" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + onClick: handleSubmit, + label: (0,external_wp_i18n_namespaceObject.__)('Submit'), + icon: keyboard_return, + className: "block-editor-link-control__search-submit", + disabled: currentInputIsEmpty // Disallow submitting empty values. + + })))), errorMessage && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, { + className: "block-editor-link-control__search-error", + status: "error", + isDismissible: false + }, errorMessage)), value && !isEditingLink && !isCreatingPage && (0,external_wp_element_namespaceObject.createElement)(LinkPreview, { + key: value === null || value === void 0 ? void 0 : value.url // force remount when URL changes to avoid race conditions for rich previews + , + value: value, + onEditClick: () => setIsEditingLink(true), + hasRichPreviews: hasRichPreviews, + hasUnlinkControl: shownUnlinkControl, + onRemove: onRemove + }), showSettingsDrawer && (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-link-control__tools" + }, (0,external_wp_element_namespaceObject.createElement)(settings_drawer, { + value: value, + settings: settings, + onChange: onChange + })), renderControlBottom && renderControlBottom()); +} + +LinkControl.ViewerFill = ViewerFill; +/* harmony default export */ var link_control = (LinkControl); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/media.js + + +/** + * WordPress dependencies + */ + +const media = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M18.7 3H5.3C4 3 3 4 3 5.3v13.4C3 20 4 21 5.3 21h13.4c1.3 0 2.3-1 2.3-2.3V5.3C21 4 20 3 18.7 3zm.8 15.7c0 .4-.4.8-.8.8H5.3c-.4 0-.8-.4-.8-.8V5.3c0-.4.4-.8.8-.8h13.4c.4 0 .8.4.8.8v13.4zM10 15l5-3-5-3v6z" +})); +/* harmony default export */ var library_media = (media); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/upload.js + + +/** + * WordPress dependencies + */ + +const upload = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z" +})); +/* harmony default export */ var library_upload = (upload); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-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 {WPComponent} The component to be rendered. + */ + +const MediaUpload = () => null; +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-upload/README.md + */ + + +/* harmony default export */ var media_upload = ((0,external_wp_components_namespaceObject.withFilters)('editor.MediaUpload')(MediaUpload)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/media-upload/check.js +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + +function MediaUploadCheck(_ref) { + let { + fallback = null, + children + } = _ref; + const hasUploadPermissions = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getSettings + } = select(store); + return !!getSettings().mediaUpload; + }, []); + return hasUploadPermissions ? children : fallback; +} +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-upload/README.md + */ + +/* harmony default export */ var media_upload_check = (MediaUploadCheck); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/media-replace-flow/index.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + + + + + + +/** + * Internal dependencies + */ + + + + + + +const MediaReplaceFlow = _ref => { + let { + mediaURL, + mediaId, + mediaIds, + allowedTypes, + accept, + onError, + onSelect, + onSelectURL, + onFilesUpload = external_lodash_namespaceObject.noop, + name = (0,external_wp_i18n_namespaceObject.__)('Replace'), + createNotice, + removeNotice, + children, + multiple = false, + addToGallery, + handleUpload = true + } = _ref; + const [mediaURLValue, setMediaURLValue] = (0,external_wp_element_namespaceObject.useState)(mediaURL); + const mediaUpload = (0,external_wp_data_namespaceObject.useSelect)(select => { + return select(store).getSettings().mediaUpload; + }, []); + const editMediaButtonRef = (0,external_wp_element_namespaceObject.useRef)(); + const errorNoticeID = (0,external_lodash_namespaceObject.uniqueId)('block-editor/media-replace-flow/error-notice/'); + + const onUploadError = message => { + const safeMessage = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(message); + + if (onError) { + onError(safeMessage); + return; + } // We need to set a timeout for showing the notice + // so that VoiceOver and possibly other screen readers + // can announce the error afer the toolbar button + // regains focus once the upload dialog closes. + // Otherwise VO simply skips over the notice and announces + // the focused element and the open menu. + + + setTimeout(() => { + createNotice('error', safeMessage, { + speak: true, + id: errorNoticeID, + isDismissible: true + }); + }, 1000); + }; + + const selectMedia = (media, closeMenu) => { + closeMenu(); + setMediaURLValue(media === null || media === void 0 ? void 0 : media.url); // Calling `onSelect` after the state update since it might unmount the component. + + onSelect(media); + (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('The media file has been replaced')); + removeNotice(errorNoticeID); + }; + + const uploadFiles = (event, closeMenu) => { + const files = event.target.files; + + if (!handleUpload) { + closeMenu(); + return onSelect(files); + } + + onFilesUpload(files); + mediaUpload({ + allowedTypes, + filesList: files, + onFileChange: _ref2 => { + let [media] = _ref2; + selectMedia(media, closeMenu); + }, + onError: onUploadError + }); + }; + + const openOnArrowDown = event => { + if (event.keyCode === external_wp_keycodes_namespaceObject.DOWN) { + event.preventDefault(); + event.target.click(); + } + }; + + const onlyAllowsImages = () => { + if (!allowedTypes || allowedTypes.length === 0) { + return false; + } + + return allowedTypes.every(allowedType => allowedType === 'image' || allowedType.startsWith('image/')); + }; + + const gallery = multiple && onlyAllowsImages(); + const POPOVER_PROPS = { + isAlternate: true + }; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { + popoverProps: POPOVER_PROPS, + contentClassName: "block-editor-media-replace-flow__options", + renderToggle: _ref3 => { + let { + isOpen, + onToggle + } = _ref3; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + ref: editMediaButtonRef, + "aria-expanded": isOpen, + "aria-haspopup": "true", + onClick: onToggle, + onKeyDown: openOnArrowDown + }, name); + }, + renderContent: _ref4 => { + let { + onClose + } = _ref4; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NavigableMenu, { + className: "block-editor-media-replace-flow__media-upload-menu" + }, (0,external_wp_element_namespaceObject.createElement)(media_upload, { + gallery: gallery, + addToGallery: addToGallery, + multiple: multiple, + value: multiple ? mediaIds : mediaId, + onSelect: media => selectMedia(media, onClose), + allowedTypes: allowedTypes, + render: _ref5 => { + let { + open + } = _ref5; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + icon: library_media, + onClick: open + }, (0,external_wp_i18n_namespaceObject.__)('Open Media Library')); + } + }), (0,external_wp_element_namespaceObject.createElement)(media_upload_check, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FormFileUpload, { + onChange: event => { + uploadFiles(event, onClose); + }, + accept: accept, + multiple: multiple, + render: _ref6 => { + let { + openFileDialog + } = _ref6; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + icon: library_upload, + onClick: () => { + openFileDialog(); + } + }, (0,external_wp_i18n_namespaceObject.__)('Upload')); + } + })), children), onSelectURL && // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions + (0,external_wp_element_namespaceObject.createElement)("form", { + className: "block-editor-media-flow__url-input" + }, (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-media-replace-flow__image-url-label" + }, (0,external_wp_i18n_namespaceObject.__)('Current media URL:')), (0,external_wp_element_namespaceObject.createElement)(link_control, { + value: { + url: mediaURLValue + }, + settings: [], + showSuggestions: false, + onChange: _ref7 => { + let { + url + } = _ref7; + setMediaURLValue(url); + onSelectURL(url); + editMediaButtonRef.current.focus(); + } + }))); + } + }); +}; +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-replace-flow/README.md + */ + + +/* harmony default export */ var media_replace_flow = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withDispatch)(dispatch => { + const { + createNotice, + removeNotice + } = dispatch(external_wp_notices_namespaceObject.store); + return { + createNotice, + removeNotice + }; +}), (0,external_wp_components_namespaceObject.withFilters)('editor.MediaReplaceFlow')])(MediaReplaceFlow)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-viewer-url.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + +function LinkViewerURL(_ref) { + let { + url, + urlLabel, + className + } = _ref; + const linkClassName = classnames_default()(className, 'block-editor-url-popover__link-viewer-url'); + + if (!url) { + return (0,external_wp_element_namespaceObject.createElement)("span", { + className: linkClassName + }); + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { + className: linkClassName, + href: url + }, urlLabel || (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURI)(url))); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-viewer.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + +function LinkViewer(_ref) { + let { + className, + linkClassName, + onEditLinkClick, + url, + urlLabel, + ...props + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)("div", _extends({ + className: classnames_default()('block-editor-url-popover__link-viewer', className) + }, props), (0,external_wp_element_namespaceObject.createElement)(LinkViewerURL, { + url: url, + urlLabel: urlLabel, + className: linkClassName + }), onEditLinkClick && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + icon: library_edit, + label: (0,external_wp_i18n_namespaceObject.__)('Edit'), + onClick: onEditLinkClick + })); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-editor.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + +function LinkEditor(_ref) { + let { + autocompleteRef, + className, + onChangeInputValue, + value, + ...props + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)("form", _extends({ + className: classnames_default()('block-editor-url-popover__link-editor', className) + }, props), (0,external_wp_element_namespaceObject.createElement)(url_input, { + value: value, + onChange: onChangeInputValue, + autocompleteRef: autocompleteRef + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + icon: keyboard_return, + label: (0,external_wp_i18n_namespaceObject.__)('Apply'), + type: "submit" + })); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/index.js + + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + +function URLPopover(_ref) { + let { + additionalControls, + children, + renderSettings, + position = 'bottom center', + focusOnMount = 'firstElement', + ...popoverProps + } = _ref; + const [isSettingsExpanded, setIsSettingsExpanded] = (0,external_wp_element_namespaceObject.useState)(false); + const showSettings = !!renderSettings && isSettingsExpanded; + + const toggleSettingsVisibility = () => { + setIsSettingsExpanded(!isSettingsExpanded); + }; + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, _extends({ + className: "block-editor-url-popover", + focusOnMount: focusOnMount, + position: position + }, popoverProps), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-url-popover__input-container" + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-url-popover__row" + }, children, !!renderSettings && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + className: "block-editor-url-popover__settings-toggle", + icon: chevron_down, + label: (0,external_wp_i18n_namespaceObject.__)('Link settings'), + onClick: toggleSettingsVisibility, + "aria-expanded": isSettingsExpanded + })), showSettings && (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-url-popover__row block-editor-url-popover__settings" + }, renderSettings())), additionalControls && !showSettings && (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-url-popover__additional-controls" + }, additionalControls)); +} + +URLPopover.LinkEditor = LinkEditor; +URLPopover.LinkViewer = LinkViewer; +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-popover/README.md + */ + +/* harmony default export */ var url_popover = (URLPopover); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/media-placeholder/index.js + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + + + + +const InsertFromURLPopover = _ref => { + let { + src, + onChange, + onSubmit, + onClose + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)(url_popover, { + onClose: onClose + }, (0,external_wp_element_namespaceObject.createElement)("form", { + className: "block-editor-media-placeholder__url-input-form", + onSubmit: onSubmit + }, (0,external_wp_element_namespaceObject.createElement)("input", { + className: "block-editor-media-placeholder__url-input-field", + type: "text", + "aria-label": (0,external_wp_i18n_namespaceObject.__)('URL'), + placeholder: (0,external_wp_i18n_namespaceObject.__)('Paste or type URL'), + onChange: onChange, + value: src + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + className: "block-editor-media-placeholder__url-input-submit-button", + icon: keyboard_return, + label: (0,external_wp_i18n_namespaceObject.__)('Apply'), + type: "submit" + }))); +}; + +function MediaPlaceholder(_ref2) { + let { + value = {}, + allowedTypes, + className, + icon, + labels = {}, + mediaPreview, + notices, + isAppender, + accept, + addToGallery, + multiple = false, + handleUpload = true, + disableDropZone, + disableMediaButtons, + onError, + onSelect, + onCancel, + onSelectURL, + onDoubleClick, + onFilesPreUpload = external_lodash_namespaceObject.noop, + onHTMLDrop = external_lodash_namespaceObject.noop, + children, + mediaLibraryButton, + placeholder, + style + } = _ref2; + const mediaUpload = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getSettings + } = select(store); + return getSettings().mediaUpload; + }, []); + const [src, setSrc] = (0,external_wp_element_namespaceObject.useState)(''); + const [isURLInputVisible, setIsURLInputVisible] = (0,external_wp_element_namespaceObject.useState)(false); + (0,external_wp_element_namespaceObject.useEffect)(() => { + var _value$src; + + setSrc((_value$src = value === null || value === void 0 ? void 0 : value.src) !== null && _value$src !== void 0 ? _value$src : ''); + }, [value === null || value === void 0 ? void 0 : value.src]); + + const onlyAllowsImages = () => { + if (!allowedTypes || allowedTypes.length === 0) { + return false; + } + + return allowedTypes.every(allowedType => allowedType === 'image' || allowedType.startsWith('image/')); + }; + + const onChangeSrc = event => { + setSrc(event.target.value); + }; + + const openURLInput = () => { + setIsURLInputVisible(true); + }; + + const closeURLInput = () => { + setIsURLInputVisible(false); + }; + + const onSubmitSrc = event => { + event.preventDefault(); + + if (src && onSelectURL) { + onSelectURL(src); + closeURLInput(); + } + }; + + const onFilesUpload = files => { + if (!handleUpload) { + return onSelect(files); + } + + onFilesPreUpload(files); + let setMedia; + + if (multiple) { + if (addToGallery) { + // Since the setMedia function runs multiple times per upload group + // and is passed newMedia containing every item in its group each time, we must + // filter out whatever this upload group had previously returned to the + // gallery before adding and returning the image array with replacement newMedia + // values. + // Define an array to store urls from newMedia between subsequent function calls. + let lastMediaPassed = []; + + setMedia = newMedia => { + // Remove any images this upload group is responsible for (lastMediaPassed). + // Their replacements are contained in newMedia. + const filteredMedia = (value !== null && value !== void 0 ? value : []).filter(item => { + // If Item has id, only remove it if lastMediaPassed has an item with that id. + if (item.id) { + return !lastMediaPassed.some( // Be sure to convert to number for comparison. + _ref3 => { + let { + id + } = _ref3; + return Number(id) === Number(item.id); + }); + } // Compare transient images via .includes since gallery may append extra info onto the url. + + + return !lastMediaPassed.some(_ref4 => { + let { + urlSlug + } = _ref4; + return item.url.includes(urlSlug); + }); + }); // Return the filtered media array along with newMedia. + + onSelect(filteredMedia.concat(newMedia)); // Reset lastMediaPassed and set it with ids and urls from newMedia. + + lastMediaPassed = newMedia.map(media => { + // Add everything up to '.fileType' to compare via .includes. + const cutOffIndex = media.url.lastIndexOf('.'); + const urlSlug = media.url.slice(0, cutOffIndex); + return { + id: media.id, + urlSlug + }; + }); + }; + } else { + setMedia = onSelect; + } + } else { + setMedia = _ref5 => { + let [media] = _ref5; + return onSelect(media); + }; + } + + mediaUpload({ + allowedTypes, + filesList: files, + onFileChange: setMedia, + onError + }); + }; + + const onUpload = event => { + onFilesUpload(event.target.files); + }; + + const defaultRenderPlaceholder = content => { + let { + instructions, + title + } = labels; + + if (!mediaUpload && !onSelectURL) { + instructions = (0,external_wp_i18n_namespaceObject.__)('To edit this block, you need permission to upload media.'); + } + + if (instructions === undefined || title === undefined) { + const typesAllowed = allowedTypes !== null && allowedTypes !== void 0 ? allowedTypes : []; + const [firstAllowedType] = typesAllowed; + const isOneType = 1 === typesAllowed.length; + const isAudio = isOneType && 'audio' === firstAllowedType; + const isImage = isOneType && 'image' === firstAllowedType; + const isVideo = isOneType && 'video' === firstAllowedType; + + if (instructions === undefined && mediaUpload) { + instructions = (0,external_wp_i18n_namespaceObject.__)('Upload a media file or pick one from your media library.'); + + if (isAudio) { + instructions = (0,external_wp_i18n_namespaceObject.__)('Upload an audio file, pick one from your media library, or add one with a URL.'); + } else if (isImage) { + instructions = (0,external_wp_i18n_namespaceObject.__)('Upload an image file, pick one from your media library, or add one with a URL.'); + } else if (isVideo) { + instructions = (0,external_wp_i18n_namespaceObject.__)('Upload a video file, pick one from your media library, or add one with a URL.'); + } + } + + if (title === undefined) { + title = (0,external_wp_i18n_namespaceObject.__)('Media'); + + if (isAudio) { + title = (0,external_wp_i18n_namespaceObject.__)('Audio'); + } else if (isImage) { + title = (0,external_wp_i18n_namespaceObject.__)('Image'); + } else if (isVideo) { + title = (0,external_wp_i18n_namespaceObject.__)('Video'); + } + } + } + + const placeholderClassName = classnames_default()('block-editor-media-placeholder', className, { + 'is-appender': isAppender + }); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, { + icon: icon, + label: title, + instructions: instructions, + className: placeholderClassName, + notices: notices, + onDoubleClick: onDoubleClick, + preview: mediaPreview, + style: style + }, content, children); + }; + + const renderPlaceholder = placeholder !== null && placeholder !== void 0 ? placeholder : defaultRenderPlaceholder; + + const renderDropZone = () => { + if (disableDropZone) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropZone, { + onFilesDrop: onFilesUpload, + onHTMLDrop: onHTMLDrop + }); + }; + + const renderCancelLink = () => { + return onCancel && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + className: "block-editor-media-placeholder__cancel-button", + title: (0,external_wp_i18n_namespaceObject.__)('Cancel'), + variant: "link", + onClick: onCancel + }, (0,external_wp_i18n_namespaceObject.__)('Cancel')); + }; + + const renderUrlSelectionUI = () => { + return onSelectURL && (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-media-placeholder__url-input-container" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + className: "block-editor-media-placeholder__button", + onClick: openURLInput, + isPressed: isURLInputVisible, + variant: "tertiary" + }, (0,external_wp_i18n_namespaceObject.__)('Insert from URL')), isURLInputVisible && (0,external_wp_element_namespaceObject.createElement)(InsertFromURLPopover, { + src: src, + onChange: onChangeSrc, + onSubmit: onSubmitSrc, + onClose: closeURLInput + })); + }; + + const renderMediaUploadChecked = () => { + const defaultButton = _ref6 => { + let { + open + } = _ref6; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + variant: "tertiary", + onClick: () => { + open(); + } + }, (0,external_wp_i18n_namespaceObject.__)('Media Library')); + }; + + const libraryButton = mediaLibraryButton !== null && mediaLibraryButton !== void 0 ? mediaLibraryButton : defaultButton; + const uploadMediaLibraryButton = (0,external_wp_element_namespaceObject.createElement)(media_upload, { + addToGallery: addToGallery, + gallery: multiple && onlyAllowsImages(), + multiple: multiple, + onSelect: onSelect, + allowedTypes: allowedTypes, + value: Array.isArray(value) ? value.map(_ref7 => { + let { + id + } = _ref7; + return id; + }) : value.id, + render: libraryButton + }); + + if (mediaUpload && isAppender) { + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, renderDropZone(), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FormFileUpload, { + onChange: onUpload, + accept: accept, + multiple: multiple, + render: _ref8 => { + let { + openFileDialog + } = _ref8; + const content = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + variant: "primary", + className: classnames_default()('block-editor-media-placeholder__button', 'block-editor-media-placeholder__upload-button'), + onClick: openFileDialog + }, (0,external_wp_i18n_namespaceObject.__)('Upload')), uploadMediaLibraryButton, renderUrlSelectionUI(), renderCancelLink()); + return renderPlaceholder(content); + } + })); + } + + if (mediaUpload) { + const content = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, renderDropZone(), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FormFileUpload, { + variant: "primary", + className: classnames_default()('block-editor-media-placeholder__button', 'block-editor-media-placeholder__upload-button'), + onChange: onUpload, + accept: accept, + multiple: multiple + }, (0,external_wp_i18n_namespaceObject.__)('Upload')), uploadMediaLibraryButton, renderUrlSelectionUI(), renderCancelLink()); + return renderPlaceholder(content); + } + + return renderPlaceholder(uploadMediaLibraryButton); + }; + + if (disableMediaButtons) { + return (0,external_wp_element_namespaceObject.createElement)(media_upload_check, null, renderDropZone()); + } + + return (0,external_wp_element_namespaceObject.createElement)(media_upload_check, { + fallback: renderPlaceholder(renderUrlSelectionUI()) + }, renderMediaUploadChecked()); +} +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-placeholder/README.md + */ + +/* harmony default export */ var media_placeholder = ((0,external_wp_components_namespaceObject.withFilters)('editor.MediaPlaceholder')(MediaPlaceholder)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/panel-color-settings/index.js + + + +/** + * Internal dependencies + */ + + +const PanelColorSettings = _ref => { + let { + colorSettings, + ...props + } = _ref; + const settings = colorSettings.map(setting => { + if (!setting) { + return setting; + } + + const { + value, + onChange, + ...otherSettings + } = setting; + return { ...otherSettings, + colorValue: value, + onColorChange: onChange + }; + }); + return (0,external_wp_element_namespaceObject.createElement)(panel_color_gradient_settings, _extends({ + settings: settings, + gradients: [], + disableCustomGradients: true + }, props)); +}; + +/* harmony default export */ var panel_color_settings = (PanelColorSettings); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-toolbar/index.js + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + +const format_toolbar_POPOVER_PROPS = { + position: 'bottom right', + isAlternate: true +}; + +const FormatToolbar = () => { + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, ['bold', 'italic', 'link'].map(format => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, { + name: `RichText.ToolbarControls.${format}`, + key: format + })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, { + name: "RichText.ToolbarControls" + }, fills => { + if (!fills.length) { + return null; + } + + const allProps = fills.map(_ref => { + let [{ + props + }] = _ref; + return props; + }); + const hasActive = allProps.some(_ref2 => { + let { + isActive + } = _ref2; + return isActive; + }); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, null, toggleProps => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, { + icon: chevron_down + /* translators: button label text should, if possible, be under 16 characters. */ + , + label: (0,external_wp_i18n_namespaceObject.__)('More'), + toggleProps: { ...toggleProps, + className: classnames_default()(toggleProps.className, { + 'is-pressed': hasActive + }), + describedBy: (0,external_wp_i18n_namespaceObject.__)('Displays more block tools') + }, + controls: (0,external_lodash_namespaceObject.orderBy)(fills.map(_ref3 => { + let [{ + props + }] = _ref3; + return props; + }), 'title'), + popoverProps: format_toolbar_POPOVER_PROPS + })); + })); +}; + +/* harmony default export */ var format_toolbar = (FormatToolbar); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-toolbar-container.js + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + + +const FormatToolbarContainer = _ref => { + let { + inline, + anchorRef + } = _ref; + + if (inline) { + // Render in popover. + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, { + noArrow: true, + position: "top center", + focusOnMount: false, + anchorRef: anchorRef, + className: "block-editor-rich-text__inline-format-toolbar", + __unstableSlotName: "block-toolbar" + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-rich-text__inline-format-toolbar-group" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_wp_element_namespaceObject.createElement)(format_toolbar, null)))); + } // Render regular toolbar. + + + return (0,external_wp_element_namespaceObject.createElement)(block_controls, { + group: "inline" + }, (0,external_wp_element_namespaceObject.createElement)(format_toolbar, null)); +}; + +/* harmony default export */ var format_toolbar_container = (FormatToolbarContainer); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-undo-automatic-change.js +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + +function useUndoAutomaticChange() { + const { + didAutomaticChange, + getSettings + } = (0,external_wp_data_namespaceObject.useSelect)(store); + return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { + function onKeyDown(event) { + const { + keyCode + } = event; + + if (event.defaultPrevented) { + return; + } + + if (keyCode !== external_wp_keycodes_namespaceObject.DELETE && keyCode !== external_wp_keycodes_namespaceObject.BACKSPACE && keyCode !== external_wp_keycodes_namespaceObject.ESCAPE) { + return; + } + + if (!didAutomaticChange()) { + return; + } + + event.preventDefault(); + + getSettings().__experimentalUndo(); + } + + element.addEventListener('keydown', onKeyDown); + return () => { + element.removeEventListener('keydown', onKeyDown); + }; + }, []); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-caret-in-format.js +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +function useCaretInFormat(_ref) { + let { + value + } = _ref; + const hasActiveFormats = value.activeFormats && !!value.activeFormats.length; + const { + isCaretWithinFormattedText + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const { + enterFormattedText, + exitFormattedText + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (hasActiveFormats) { + if (!isCaretWithinFormattedText()) { + enterFormattedText(); + } + } else if (isCaretWithinFormattedText()) { + exitFormattedText(); + } + }, [hasActiveFormats]); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-mark-persistent.js +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +function useMarkPersistent(_ref) { + let { + html, + value + } = _ref; + const previousText = (0,external_wp_element_namespaceObject.useRef)(); + const hasActiveFormats = value.activeFormats && !!value.activeFormats.length; + const { + __unstableMarkLastChangeAsPersistent + } = (0,external_wp_data_namespaceObject.useDispatch)(store); // Must be set synchronously to make sure it applies to the last change. + + (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { + // Ignore mount. + if (!previousText.current) { + previousText.current = value.text; + return; + } // Text input, so don't create an undo level for every character. + // Create an undo level after 1 second of no input. + + + if (previousText.current !== value.text) { + const timeout = window.setTimeout(() => { + __unstableMarkLastChangeAsPersistent(); + }, 1000); + previousText.current = value.text; + return () => { + window.clearTimeout(timeout); + }; + } + + __unstableMarkLastChangeAsPersistent(); + }, [html, hasActiveFormats]); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/file-paste-handler.js +/** + * WordPress dependencies + */ + +function filePasteHandler(files) { + return files.filter(_ref => { + let { + type + } = _ref; + return /^image\/(?:jpe?g|png|gif|webp)$/.test(type); + }).map(file => ``).join(''); +} + +;// CONCATENATED MODULE: external ["wp","shortcode"] +var external_wp_shortcode_namespaceObject = window["wp"]["shortcode"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/utils.js + + +/** + * WordPress dependencies + */ + + + + +function addActiveFormats(value, activeFormats) { + if (activeFormats !== null && activeFormats !== void 0 && activeFormats.length) { + let index = value.formats.length; + + while (index--) { + value.formats[index] = [...activeFormats, ...(value.formats[index] || [])]; + } + } +} +/** + * Get the multiline tag based on the multiline prop. + * + * @param {?(string|boolean)} multiline The multiline prop. + * + * @return {?string} The multiline tag. + */ + +function getMultilineTag(multiline) { + if (multiline !== true && multiline !== 'p' && multiline !== 'li') { + return; + } + + return multiline === true ? 'p' : multiline; +} +function getAllowedFormats(_ref) { + let { + allowedFormats, + formattingControls, + disableFormats + } = _ref; + + if (disableFormats) { + return getAllowedFormats.EMPTY_ARRAY; + } + + if (!allowedFormats && !formattingControls) { + return; + } + + if (allowedFormats) { + return allowedFormats; + } + + external_wp_deprecated_default()('wp.blockEditor.RichText formattingControls prop', { + since: '5.4', + alternative: 'allowedFormats', + version: '6.2' + }); + return formattingControls.map(name => `core/${name}`); +} +getAllowedFormats.EMPTY_ARRAY = []; +const isShortcode = text => (0,external_wp_shortcode_namespaceObject.regexp)('.*').test(text); +/** + * Creates a link from pasted URL. + * Creates a paragraph block containing a link to the URL, and calls `onReplace`. + * + * @param {string} url The URL that could not be embedded. + * @param {Function} onReplace Function to call with the created fallback block. + */ + +function createLinkInParagraph(url, onReplace) { + const link = createElement("a", { + href: url + }, url); + onReplace(createBlock('core/paragraph', { + content: renderToString(link) + })); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/split-value.js +/** + * WordPress dependencies + */ + +/* + * Signals to the RichText owner that the block can be replaced with two blocks + * as a result of splitting the block by pressing enter, or with blocks as a + * result of splitting the block by pasting block content in the instance. + */ + +function splitValue(_ref) { + let { + value, + pastedBlocks = [], + onReplace, + onSplit, + onSplitMiddle, + multilineTag + } = _ref; + + if (!onReplace || !onSplit) { + return; + } // Ensure the value has a selection. This might happen when trying to split + // an empty value before there was a `selectionchange` event. + + + const { + start = 0, + end = 0 + } = value; + const valueWithEnsuredSelection = { ...value, + start, + end + }; + const blocks = []; + const [before, after] = (0,external_wp_richText_namespaceObject.split)(valueWithEnsuredSelection); + const hasPastedBlocks = pastedBlocks.length > 0; + let lastPastedBlockIndex = -1; // Consider the after value to be the original it is not empty and the + // before value *is* empty. + + const isAfterOriginal = (0,external_wp_richText_namespaceObject.isEmpty)(before) && !(0,external_wp_richText_namespaceObject.isEmpty)(after); // Create a block with the content before the caret if there's no pasted + // blocks, or if there are pasted blocks and the value is not empty. We do + // not want a leading empty block on paste, but we do if split with e.g. the + // enter key. + + if (!hasPastedBlocks || !(0,external_wp_richText_namespaceObject.isEmpty)(before)) { + blocks.push(onSplit((0,external_wp_richText_namespaceObject.toHTMLString)({ + value: before, + multilineTag + }), !isAfterOriginal)); + lastPastedBlockIndex += 1; + } + + if (hasPastedBlocks) { + blocks.push(...pastedBlocks); + lastPastedBlockIndex += pastedBlocks.length; + } else if (onSplitMiddle) { + blocks.push(onSplitMiddle()); + } // If there's pasted blocks, append a block with non empty content / after + // the caret. Otherwise, do append an empty block if there is no + // `onSplitMiddle` prop, but if there is and the content is empty, the + // middle block is enough to set focus in. + + + if (hasPastedBlocks ? !(0,external_wp_richText_namespaceObject.isEmpty)(after) : !onSplitMiddle || !(0,external_wp_richText_namespaceObject.isEmpty)(after)) { + blocks.push(onSplit((0,external_wp_richText_namespaceObject.toHTMLString)({ + value: after, + multilineTag + }), isAfterOriginal)); + } // If there are pasted blocks, set the selection to the last one. Otherwise, + // set the selection to the second block. + + + const indexToSelect = hasPastedBlocks ? lastPastedBlockIndex : 1; // If there are pasted blocks, move the caret to the end of the selected + // block Otherwise, retain the default value. + + const initialPosition = hasPastedBlocks ? -1 : 0; + onReplace(blocks, indexToSelect, initialPosition); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-paste-handler.js +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + + + +/** @typedef {import('@wordpress/rich-text').RichTextValue} RichTextValue */ + +/** + * Replaces line separators with line breaks if not multiline. + * Replaces line breaks with line separators if multiline. + * + * @param {RichTextValue} value Value to adjust. + * @param {boolean} isMultiline Whether to adjust to multiline or not. + * + * @return {RichTextValue} Adjusted value. + */ + +function adjustLines(value, isMultiline) { + if (isMultiline) { + return (0,external_wp_richText_namespaceObject.replace)(value, /\n+/g, external_wp_richText_namespaceObject.__UNSTABLE_LINE_SEPARATOR); + } + + return (0,external_wp_richText_namespaceObject.replace)(value, new RegExp(external_wp_richText_namespaceObject.__UNSTABLE_LINE_SEPARATOR, 'g'), '\n'); +} + +function usePasteHandler(props) { + const propsRef = (0,external_wp_element_namespaceObject.useRef)(props); + propsRef.current = props; + return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { + function _onPaste(event) { + const { + isSelected, + disableFormats, + onChange, + value, + formatTypes, + tagName, + onReplace, + onSplit, + onSplitMiddle, + __unstableEmbedURLOnPaste, + multilineTag, + preserveWhiteSpace, + pastePlainText + } = propsRef.current; + + if (!isSelected) { + return; + } + + const { + clipboardData + } = event; + let plainText = ''; + let 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; + } + } // Remove Windows-specific metadata appended within copied HTML text. + + + html = removeWindowsFragments(html); // Strip meta tag. + + html = removeCharsetMetaTag(html); + 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); + + if (disableFormats) { + onChange((0,external_wp_richText_namespaceObject.insert)(value, plainText)); + return; + } + + const transformed = formatTypes.reduce((accumlator, _ref) => { + let { + __unstablePasteRule + } = _ref; + + // Only allow one transform. + if (__unstablePasteRule && accumlator === value) { + accumlator = __unstablePasteRule(value, { + html, + plainText + }); + } + + return accumlator; + }, value); + + if (transformed !== value) { + onChange(transformed); + return; + } + + const files = [...(0,external_wp_dom_namespaceObject.getFilesFromDataTransfer)(clipboardData)]; + const isInternal = clipboardData.getData('rich-text') === 'true'; // If the data comes from a rich text instance, we can directly use it + // without filtering the data. The filters are only meant for externally + // pasted content and remove inline styles. + + if (isInternal) { + const pastedMultilineTag = clipboardData.getData('rich-text-multi-line-tag') || undefined; + let pastedValue = (0,external_wp_richText_namespaceObject.create)({ + html, + multilineTag: pastedMultilineTag, + multilineWrapperTags: pastedMultilineTag === 'li' ? ['ul', 'ol'] : undefined, + preserveWhiteSpace + }); + pastedValue = adjustLines(pastedValue, !!multilineTag); + addActiveFormats(pastedValue, value.activeFormats); + onChange((0,external_wp_richText_namespaceObject.insert)(value, pastedValue)); + return; + } + + if (pastePlainText) { + onChange((0,external_wp_richText_namespaceObject.insert)(value, (0,external_wp_richText_namespaceObject.create)({ + text: plainText + }))); + return; + } // Process any attached files, unless we infer that the files in + // question are redundant "screenshots" of the actual HTML payload, + // as created by certain office-type programs. + // + // @see shouldDismissPastedFiles + + + if (files !== null && files !== void 0 && files.length && !shouldDismissPastedFiles(files, html, plainText)) { + const content = (0,external_wp_blocks_namespaceObject.pasteHandler)({ + HTML: filePasteHandler(files), + mode: 'BLOCKS', + tagName, + preserveWhiteSpace + }); // Allows us to ask for this information when we get a report. + // eslint-disable-next-line no-console + + window.console.log('Received items:\n\n', files); + + if (onReplace && (0,external_wp_richText_namespaceObject.isEmpty)(value)) { + onReplace(content); + } else { + splitValue({ + value, + pastedBlocks: content, + onReplace, + onSplit, + onSplitMiddle, + multilineTag + }); + } + + return; + } + + let mode = onReplace && onSplit ? 'AUTO' : 'INLINE'; // Force the blocks mode when the user is pasting + // on a new line & the content resembles a shortcode. + // Otherwise it's going to be detected as inline + // and the shortcode won't be replaced. + + if (mode === 'AUTO' && (0,external_wp_richText_namespaceObject.isEmpty)(value) && isShortcode(plainText)) { + mode = 'BLOCKS'; + } + + if (__unstableEmbedURLOnPaste && (0,external_wp_richText_namespaceObject.isEmpty)(value) && (0,external_wp_url_namespaceObject.isURL)(plainText.trim())) { + mode = 'BLOCKS'; + } + + const content = (0,external_wp_blocks_namespaceObject.pasteHandler)({ + HTML: html, + plainText, + mode, + tagName, + preserveWhiteSpace + }); + + if (typeof content === 'string') { + let valueToInsert = (0,external_wp_richText_namespaceObject.create)({ + html: content + }); // If the content should be multiline, we should process text + // separated by a line break as separate lines. + + valueToInsert = adjustLines(valueToInsert, !!multilineTag); + addActiveFormats(valueToInsert, value.activeFormats); + onChange((0,external_wp_richText_namespaceObject.insert)(value, valueToInsert)); + } else if (content.length > 0) { + if (onReplace && (0,external_wp_richText_namespaceObject.isEmpty)(value)) { + onReplace(content, content.length - 1, -1); + } else { + splitValue({ + value, + pastedBlocks: content, + onReplace, + onSplit, + onSplitMiddle, + multilineTag + }); + } + } + } + + element.addEventListener('paste', _onPaste); + return () => { + element.removeEventListener('paste', _onPaste); + }; + }, []); +} +/** + * Normalizes a given string of HTML to remove the Windows-specific "Fragment" + * comments and any preceeding and trailing content. + * + * @param {string} html the html to be normalized + * @return {string} the normalized html + */ + +function removeWindowsFragments(html) { + const startStr = ''; + const startIdx = html.indexOf(startStr); + + if (startIdx > -1) { + html = html.substring(startIdx + startStr.length); + } else { + // No point looking for EndFragment + return html; + } + + const endStr = ''; + const endIdx = html.indexOf(endStr); + + if (endIdx > -1) { + html = html.substring(0, endIdx); + } + + return html; +} +/** + * Removes the charset meta tag inserted by Chromium. + * See: + * - https://github.com/WordPress/gutenberg/issues/33585 + * - https://bugs.chromium.org/p/chromium/issues/detail?id=1264616#c4 + * + * @param {string} html the html to be stripped of the meta tag. + * @return {string} the cleaned html + */ + + +function removeCharsetMetaTag(html) { + const metaTag = ``; + + if (html.startsWith(metaTag)) { + return html.slice(metaTag.length); + } + + return html; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/prevent-event-discovery.js +/** + * WordPress dependencies + */ + +function preventEventDiscovery(value) { + const searchText = 'tales of gutenberg'; + const addText = ' 🐡🐢🦀🐤🦋🐘🐧🐹🦁🦄🦍🐼🐿🎃🐴🐝🐆🦕🦔🌱🍇π🍌🐉💧🥨🌌🍂🍠🥦🥚🥝🎟🥥🥒🛵🥖🍒🍯🎾🎲🐺🐚🐮⌛️'; + const { + start, + text + } = value; + + if (start < searchText.length) { + return value; + } + + const charactersBefore = text.slice(start - searchText.length, start); + + if (charactersBefore.toLowerCase() !== searchText) { + return value; + } + + return (0,external_wp_richText_namespaceObject.insert)(value, addText); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-input-rules.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + // A robust way to retain selection position through various +// transforms is to insert a special character at the position and +// then recover it. + +const START_OF_SELECTED_AREA = '\u0086'; + +function findSelection(blocks) { + let i = blocks.length; + + while (i--) { + const attributeKey = (0,external_lodash_namespaceObject.findKey)(blocks[i].attributes, v => typeof v === 'string' && v.indexOf(START_OF_SELECTED_AREA) !== -1); + + if (attributeKey) { + blocks[i].attributes[attributeKey] = blocks[i].attributes[attributeKey].replace(START_OF_SELECTED_AREA, ''); + return blocks[i].clientId; + } + + const nestedSelection = findSelection(blocks[i].innerBlocks); + + if (nestedSelection) { + return nestedSelection; + } + } +} + +function useInputRules(props) { + const { + __unstableMarkLastChangeAsPersistent, + __unstableMarkAutomaticChange + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const propsRef = (0,external_wp_element_namespaceObject.useRef)(props); + propsRef.current = props; + return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { + function inputRule() { + const { + value, + onReplace, + selectionChange + } = propsRef.current; + + if (!onReplace) { + return; + } + + const { + start, + text + } = value; + const characterBefore = text.slice(start - 1, start); // The character right before the caret must be a plain space. + + if (characterBefore !== ' ') { + return; + } + + const trimmedTextBefore = text.slice(0, start).trim(); + const prefixTransforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)('from').filter(_ref => { + let { + type + } = _ref; + return type === 'prefix'; + }); + const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(prefixTransforms, _ref2 => { + let { + prefix + } = _ref2; + return trimmedTextBefore === prefix; + }); + + if (!transformation) { + return; + } + + const content = (0,external_wp_richText_namespaceObject.toHTMLString)({ + value: (0,external_wp_richText_namespaceObject.insert)(value, START_OF_SELECTED_AREA, 0, start) + }); + const block = transformation.transform(content); + selectionChange(findSelection([block])); + onReplace([block]); + + __unstableMarkAutomaticChange(); + } + + function onInput(event) { + const { + inputType, + type + } = event; + const { + value, + onChange, + __unstableAllowPrefixTransformations, + formatTypes + } = propsRef.current; // Only run input rules when inserting text. + + if (inputType !== 'insertText' && type !== 'compositionend') { + return; + } + + if (__unstableAllowPrefixTransformations && inputRule) { + inputRule(); + } + + const transformed = formatTypes.reduce((accumlator, _ref3) => { + let { + __unstableInputRule + } = _ref3; + + if (__unstableInputRule) { + accumlator = __unstableInputRule(accumlator); + } + + return accumlator; + }, preventEventDiscovery(value)); + + if (transformed !== value) { + __unstableMarkLastChangeAsPersistent(); + + onChange({ ...transformed, + activeFormats: value.activeFormats + }); + + __unstableMarkAutomaticChange(); + } + } + + element.addEventListener('input', onInput); + element.addEventListener('compositionend', onInput); + return () => { + element.removeEventListener('input', onInput); + element.removeEventListener('compositionend', onInput); + }; + }, []); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-enter.js +/** + * WordPress dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + +function useEnter(props) { + const { + __unstableMarkAutomaticChange + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const propsRef = (0,external_wp_element_namespaceObject.useRef)(props); + propsRef.current = props; + return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { + function onKeyDown(event) { + if (event.defaultPrevented) { + return; + } + + const { + removeEditorOnlyFormats, + value, + onReplace, + onSplit, + onSplitMiddle, + multilineTag, + onChange, + disableLineBreaks, + onSplitAtEnd + } = propsRef.current; + + if (event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) { + return; + } + + event.preventDefault(); + const _value = { ...value + }; + _value.formats = removeEditorOnlyFormats(value); + const canSplit = onReplace && onSplit; + + if (onReplace) { + const transforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)('from').filter(_ref => { + let { + type + } = _ref; + return type === 'enter'; + }); + const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(transforms, item => { + return item.regExp.test(_value.text); + }); + + if (transformation) { + onReplace([transformation.transform({ + content: _value.text + })]); + + __unstableMarkAutomaticChange(); + } + } + + if (multilineTag) { + if (event.shiftKey) { + if (!disableLineBreaks) { + onChange((0,external_wp_richText_namespaceObject.insert)(_value, '\n')); + } + } else if (canSplit && (0,external_wp_richText_namespaceObject.__unstableIsEmptyLine)(_value)) { + splitValue({ + value: _value, + onReplace, + onSplit, + onSplitMiddle, + multilineTag + }); + } else { + onChange((0,external_wp_richText_namespaceObject.__unstableInsertLineSeparator)(_value)); + } + } else { + const { + text, + start, + end + } = _value; + const canSplitAtEnd = onSplitAtEnd && start === end && end === text.length; + + if (event.shiftKey || !canSplit && !canSplitAtEnd) { + if (!disableLineBreaks) { + onChange((0,external_wp_richText_namespaceObject.insert)(_value, '\n')); + } + } else if (!canSplit && canSplitAtEnd) { + onSplitAtEnd(); + } else if (canSplit) { + splitValue({ + value: _value, + onReplace, + onSplit, + onSplitMiddle, + multilineTag + }); + } + } + } + + element.addEventListener('keydown', onKeyDown); + return () => { + element.removeEventListener('keydown', onKeyDown); + }; + }, []); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-format-types.js +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + +function formatTypesSelector(select) { + return select(external_wp_richText_namespaceObject.store).getFormatTypes(); +} +/** + * Set of all interactive content tags. + * + * @see https://html.spec.whatwg.org/multipage/dom.html#interactive-content + */ + + +const interactiveContentTags = new Set(['a', 'audio', 'button', 'details', 'embed', 'iframe', 'input', 'label', 'select', 'textarea', 'video']); +/** + * This hook provides RichText with the `formatTypes` and its derived props from + * experimental format type settings. + * + * @param {Object} $0 Options + * @param {string} $0.clientId Block client ID. + * @param {string} $0.identifier Block attribute. + * @param {boolean} $0.withoutInteractiveFormatting Whether to clean the interactive formattings or not. + * @param {Array} $0.allowedFormats Allowed formats + */ + +function useFormatTypes(_ref) { + let { + clientId, + identifier, + withoutInteractiveFormatting, + allowedFormats + } = _ref; + const allFormatTypes = (0,external_wp_data_namespaceObject.useSelect)(formatTypesSelector, []); + const formatTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { + return allFormatTypes.filter(_ref2 => { + let { + name, + tagName + } = _ref2; + + if (allowedFormats && !allowedFormats.includes(name)) { + return false; + } + + if (withoutInteractiveFormatting && interactiveContentTags.has(tagName)) { + return false; + } + + return true; + }); + }, [allFormatTypes, allowedFormats, interactiveContentTags]); + const keyedSelected = (0,external_wp_data_namespaceObject.useSelect)(select => formatTypes.reduce((accumulator, type) => { + if (type.__experimentalGetPropsForEditableTreePreparation) { + accumulator[type.name] = type.__experimentalGetPropsForEditableTreePreparation(select, { + richTextIdentifier: identifier, + blockClientId: clientId + }); + } + + return accumulator; + }, {}), [formatTypes, clientId, identifier]); + const dispatch = (0,external_wp_data_namespaceObject.useDispatch)(); + const prepareHandlers = []; + const valueHandlers = []; + const changeHandlers = []; + const dependencies = []; + formatTypes.forEach(type => { + if (type.__experimentalCreatePrepareEditableTree) { + const selected = keyedSelected[type.name]; + + const handler = type.__experimentalCreatePrepareEditableTree(selected, { + richTextIdentifier: identifier, + blockClientId: clientId + }); + + if (type.__experimentalCreateOnChangeEditableValue) { + valueHandlers.push(handler); + } else { + prepareHandlers.push(handler); + } + + for (const key in selected) { + dependencies.push(selected[key]); + } + } + + if (type.__experimentalCreateOnChangeEditableValue) { + let dispatchers = {}; + + if (type.__experimentalGetPropsForEditableTreeChangeHandler) { + dispatchers = type.__experimentalGetPropsForEditableTreeChangeHandler(dispatch, { + richTextIdentifier: identifier, + blockClientId: clientId + }); + } + + changeHandlers.push(type.__experimentalCreateOnChangeEditableValue({ ...(keyedSelected[type.name] || {}), + ...dispatchers + }, { + richTextIdentifier: identifier, + blockClientId: clientId + })); + } + }); + return { + formatTypes, + prepareHandlers, + valueHandlers, + changeHandlers, + dependencies + }; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-remove-browser-shortcuts.js +/** + * WordPress dependencies + */ + + +/** + * Hook to prevent default behaviors for key combinations otherwise handled + * internally by RichText. + * + * @return {import('react').RefObject} The component to be rendered. + */ + +function useRemoveBrowserShortcuts() { + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { + function onKeydown(event) { + if (external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, 'z') || external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, 'y') || external_wp_keycodes_namespaceObject.isKeyboardEvent.primaryShift(event, 'z')) { + event.preventDefault(); + } + } + + node.addEventListener('keydown', onKeydown); + return () => { + node.addEventListener('keydown', onKeydown); + }; + }, []); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-shortcuts.js +/** + * WordPress dependencies + */ + +function useShortcuts(keyboardShortcuts) { + return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { + function onKeyDown(event) { + for (const keyboardShortcut of keyboardShortcuts.current) { + keyboardShortcut(event); + } + } + + element.addEventListener('keydown', onKeyDown); + return () => { + element.removeEventListener('keydown', onKeyDown); + }; + }, []); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-input-events.js +/** + * WordPress dependencies + */ + +function useInputEvents(inputEvents) { + return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { + function onInput(event) { + for (const keyboardShortcut of inputEvents.current) { + keyboardShortcut(event); + } + } + + element.addEventListener('input', onInput); + return () => { + element.removeEventListener('input', onInput); + }; + }, []); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-firefox-compat.js +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +function useFirefoxCompat() { + const { + isMultiSelecting + } = (0,external_wp_data_namespaceObject.useSelect)(store); + return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { + function onFocus() { + if (!isMultiSelecting()) { + return; + } // This is a little hack to work around focus issues with nested + // editable elements in Firefox. For some reason the editable child + // element sometimes regains focus, while it should not be focusable + // and focus should remain on the editable parent element. + // To do: try to find the cause of the shifting focus. + + + const parentEditable = element.parentElement.closest('[contenteditable="true"]'); + + if (parentEditable) { + parentEditable.focus(); + } + } + + element.addEventListener('focus', onFocus); + return () => { + element.removeEventListener('focus', onFocus); + }; + }, []); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-edit.js + + +/** + * WordPress dependencies + */ + +/** + * External dependencies + */ + + +function FormatEdit(_ref) { + let { + formatTypes, + onChange, + onFocus, + value, + forwardedRef + } = _ref; + return formatTypes.map(settings => { + const { + name, + edit: Edit + } = settings; + + if (!Edit) { + return null; + } + + const activeFormat = (0,external_wp_richText_namespaceObject.getActiveFormat)(value, name); + let isActive = activeFormat !== undefined; + const activeObject = (0,external_wp_richText_namespaceObject.getActiveObject)(value); + const isObjectActive = activeObject !== undefined && activeObject.type === name; // Edge case: un-collapsed link formats. + // If there is a missing link format at either end of the selection + // then we shouldn't show the Edit UI because the selection has exceeded + // the bounds of the link format. + // Also if the format objects don't match then we're dealing with two separate + // links so we should not allow the link to be modified over the top. + + if (name === 'core/link' && !(0,external_wp_richText_namespaceObject.isCollapsed)(value)) { + const formats = value.formats; + const linkFormatAtStart = (0,external_lodash_namespaceObject.find)(formats[value.start], { + type: 'core/link' + }); + const linkFormatAtEnd = (0,external_lodash_namespaceObject.find)(formats[value.end - 1], { + type: 'core/link' + }); + + if (!linkFormatAtStart || !linkFormatAtEnd || linkFormatAtStart !== linkFormatAtEnd) { + isActive = false; + } + } + + return (0,external_wp_element_namespaceObject.createElement)(Edit, { + key: name, + isActive: isActive, + activeAttributes: isActive ? activeFormat.attributes || {} : {}, + isObjectActive: isObjectActive, + activeObjectAttributes: isObjectActive ? activeObject.attributes || {} : {}, + value: value, + onChange: onChange, + onFocus: onFocus, + contentRef: forwardedRef + }); + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/index.js + + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + + + + + +/** + * Internal dependencies + */ + + + + + + + + + + + + + + + + + + +const keyboardShortcutContext = (0,external_wp_element_namespaceObject.createContext)(); +const inputEventContext = (0,external_wp_element_namespaceObject.createContext)(); +/** + * Removes props used for the native version of RichText so that they are not + * passed to the DOM element and log warnings. + * + * @param {Object} props Props to filter. + * + * @return {Object} Filtered props. + */ + +function removeNativeProps(props) { + return (0,external_lodash_namespaceObject.omit)(props, ['__unstableMobileNoFocusOnMount', 'deleteEnter', 'placeholderTextColor', 'textAlign', 'selectionColor', 'tagsToEliminate', 'rootTagsToEliminate', 'disableEditingMenu', 'fontSize', 'fontFamily', 'fontWeight', 'fontStyle', 'minWidth', 'maxWidth', 'setRef']); +} + +function RichTextWrapper(_ref, forwardedRef) { + let { + children, + tagName = 'div', + value: originalValue = '', + onChange: originalOnChange, + isSelected: originalIsSelected, + multiline, + inlineToolbar, + wrapperClassName, + autocompleters, + onReplace, + placeholder, + allowedFormats, + formattingControls, + withoutInteractiveFormatting, + onRemove, + onMerge, + onSplit, + __unstableOnSplitAtEnd: onSplitAtEnd, + __unstableOnSplitMiddle: onSplitMiddle, + identifier, + preserveWhiteSpace, + __unstablePastePlainText: pastePlainText, + __unstableEmbedURLOnPaste, + __unstableDisableFormats: disableFormats, + disableLineBreaks, + unstableOnFocus, + __unstableAllowPrefixTransformations, + ...props + } = _ref; + const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(RichTextWrapper); + identifier = identifier || instanceId; + props = removeNativeProps(props); + const anchorRef = (0,external_wp_element_namespaceObject.useRef)(); + const { + clientId + } = useBlockEditContext(); + + const selector = select => { + const { + getSelectionStart, + getSelectionEnd + } = select(store); + const selectionStart = getSelectionStart(); + const selectionEnd = getSelectionEnd(); + let isSelected; + + if (originalIsSelected === undefined) { + isSelected = selectionStart.clientId === clientId && selectionEnd.clientId === clientId && selectionStart.attributeKey === identifier; + } else if (originalIsSelected) { + isSelected = selectionStart.clientId === clientId; + } + + return { + selectionStart: isSelected ? selectionStart.offset : undefined, + selectionEnd: isSelected ? selectionEnd.offset : undefined, + isSelected + }; + }; // This selector must run on every render so the right selection state is + // retreived from the store on merge. + // To do: fix this somehow. + + + const { + selectionStart, + selectionEnd, + isSelected + } = (0,external_wp_data_namespaceObject.useSelect)(selector); + const { + selectionChange + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const multilineTag = getMultilineTag(multiline); + const adjustedAllowedFormats = getAllowedFormats({ + allowedFormats, + formattingControls, + disableFormats + }); + const hasFormats = !adjustedAllowedFormats || adjustedAllowedFormats.length > 0; + let adjustedValue = originalValue; + let adjustedOnChange = originalOnChange; // Handle deprecated format. + + if (Array.isArray(originalValue)) { + adjustedValue = external_wp_blocks_namespaceObject.children.toHTML(originalValue); + + adjustedOnChange = newValue => originalOnChange(external_wp_blocks_namespaceObject.children.fromDOM((0,external_wp_richText_namespaceObject.__unstableCreateElement)(document, newValue).childNodes)); + } + + const onSelectionChange = (0,external_wp_element_namespaceObject.useCallback)((start, end) => { + const selection = {}; + const unset = start === undefined && end === undefined; + + if (typeof start === 'number' || unset) { + selection.start = { + clientId, + attributeKey: identifier, + offset: start + }; + } + + if (typeof end === 'number' || unset) { + selection.end = { + clientId, + attributeKey: identifier, + offset: end + }; + } + + selectionChange(selection); + }, [clientId, identifier]); + const { + formatTypes, + prepareHandlers, + valueHandlers, + changeHandlers, + dependencies + } = useFormatTypes({ + clientId, + identifier, + withoutInteractiveFormatting, + allowedFormats: adjustedAllowedFormats + }); + + function addEditorOnlyFormats(value) { + return valueHandlers.reduce((accumulator, fn) => fn(accumulator, value.text), value.formats); + } + + function removeEditorOnlyFormats(value) { + formatTypes.forEach(formatType => { + // Remove formats created by prepareEditableTree, because they are editor only. + if (formatType.__experimentalCreatePrepareEditableTree) { + value = (0,external_wp_richText_namespaceObject.removeFormat)(value, formatType.name, 0, value.text.length); + } + }); + return value.formats; + } + + function addInvisibleFormats(value) { + return prepareHandlers.reduce((accumulator, fn) => fn(accumulator, value.text), value.formats); + } + + const { + value, + onChange, + ref: richTextRef + } = (0,external_wp_richText_namespaceObject.__unstableUseRichText)({ + value: adjustedValue, + + onChange(html, _ref2) { + let { + __unstableFormats, + __unstableText + } = _ref2; + adjustedOnChange(html); + Object.values(changeHandlers).forEach(changeHandler => { + changeHandler(__unstableFormats, __unstableText); + }); + }, + + selectionStart, + selectionEnd, + onSelectionChange, + placeholder, + __unstableIsSelected: isSelected, + __unstableMultilineTag: multilineTag, + __unstableDisableFormats: disableFormats, + preserveWhiteSpace, + __unstableDependencies: [...dependencies, tagName], + __unstableAfterParse: addEditorOnlyFormats, + __unstableBeforeSerialize: removeEditorOnlyFormats, + __unstableAddInvisibleFormats: addInvisibleFormats + }); + const autocompleteProps = useBlockEditorAutocompleteProps({ + onReplace, + completers: autocompleters, + record: value, + onChange + }); + useCaretInFormat({ + value + }); + useMarkPersistent({ + html: adjustedValue, + value + }); + const keyboardShortcuts = (0,external_wp_element_namespaceObject.useRef)(new Set()); + const inputEvents = (0,external_wp_element_namespaceObject.useRef)(new Set()); + + function onKeyDown(event) { + const { + keyCode + } = event; + + if (event.defaultPrevented) { + return; + } + + if (keyCode === external_wp_keycodes_namespaceObject.DELETE || keyCode === external_wp_keycodes_namespaceObject.BACKSPACE) { + const { + start, + end, + text + } = value; + const isReverse = keyCode === external_wp_keycodes_namespaceObject.BACKSPACE; + const hasActiveFormats = value.activeFormats && !!value.activeFormats.length; // Only process delete if the key press occurs at an uncollapsed edge. + + if (!(0,external_wp_richText_namespaceObject.isCollapsed)(value) || hasActiveFormats || isReverse && start !== 0 || !isReverse && end !== text.length) { + 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 && (0,external_wp_richText_namespaceObject.isEmpty)(value) && isReverse) { + onRemove(!isReverse); + } + + event.preventDefault(); + } + } + + function onFocus() { + anchorRef.current.focus(); + } + + const TagName = tagName; + const content = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isSelected && (0,external_wp_element_namespaceObject.createElement)(keyboardShortcutContext.Provider, { + value: keyboardShortcuts + }, (0,external_wp_element_namespaceObject.createElement)(inputEventContext.Provider, { + value: inputEvents + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover.__unstableSlotNameProvider, { + value: "__unstable-block-tools-after" + }, children && children({ + value, + onChange, + onFocus + }), (0,external_wp_element_namespaceObject.createElement)(FormatEdit, { + value: value, + onChange: onChange, + onFocus: onFocus, + formatTypes: formatTypes, + forwardedRef: anchorRef + })))), isSelected && hasFormats && (0,external_wp_element_namespaceObject.createElement)(format_toolbar_container, { + inline: inlineToolbar, + anchorRef: anchorRef.current + }), (0,external_wp_element_namespaceObject.createElement)(TagName // Overridable props. + , _extends({ + role: "textbox", + "aria-multiline": !disableLineBreaks, + "aria-label": placeholder + }, props, autocompleteProps, { + ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([forwardedRef, autocompleteProps.ref, props.ref, richTextRef, useInputRules({ + value, + onChange, + __unstableAllowPrefixTransformations, + formatTypes, + onReplace, + selectionChange + }), useRemoveBrowserShortcuts(), useShortcuts(keyboardShortcuts), useInputEvents(inputEvents), useUndoAutomaticChange(), usePasteHandler({ + isSelected, + disableFormats, + onChange, + value, + formatTypes, + tagName, + onReplace, + onSplit, + onSplitMiddle, + __unstableEmbedURLOnPaste, + multilineTag, + preserveWhiteSpace, + pastePlainText + }), useEnter({ + removeEditorOnlyFormats, + value, + onReplace, + onSplit, + onSplitMiddle, + multilineTag, + onChange, + disableLineBreaks, + onSplitAtEnd + }), useFirefoxCompat(), anchorRef]), + contentEditable: true, + suppressContentEditableWarning: true, + className: classnames_default()('block-editor-rich-text__editable', props.className, 'rich-text'), + onFocus: unstableOnFocus, + onKeyDown: onKeyDown + }))); + + if (!wrapperClassName) { + return content; + } + + external_wp_deprecated_default()('wp.blockEditor.RichText wrapperClassName prop', { + since: '5.4', + alternative: 'className prop or create your own wrapper div', + version: '6.2' + }); + const className = classnames_default()('block-editor-rich-text', wrapperClassName); + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: className + }, content); +} + +const ForwardedRichTextContainer = (0,external_wp_element_namespaceObject.forwardRef)(RichTextWrapper); + +ForwardedRichTextContainer.Content = _ref3 => { + let { + value, + tagName: Tag, + multiline, + ...props + } = _ref3; + + // Handle deprecated `children` and `node` sources. + if (Array.isArray(value)) { + value = external_wp_blocks_namespaceObject.children.toHTML(value); + } + + const MultilineTag = getMultilineTag(multiline); + + if (!value && MultilineTag) { + value = `<${MultilineTag}>`; + } + + const content = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, value); + + if (Tag) { + return (0,external_wp_element_namespaceObject.createElement)(Tag, (0,external_lodash_namespaceObject.omit)(props, ['format']), content); + } + + return content; +}; + +ForwardedRichTextContainer.isEmpty = value => { + return !value || value.length === 0; +}; +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md + */ + + +/* harmony default export */ var rich_text = (ForwardedRichTextContainer); + + + + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/editable-text/index.js + + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + +const EditableText = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { + return (0,external_wp_element_namespaceObject.createElement)(rich_text, _extends({ + ref: ref + }, props, { + __unstableDisableFormats: true, + preserveWhiteSpace: true + })); +}); + +EditableText.Content = _ref => { + let { + value = '', + tagName: Tag = 'div', + ...props + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)(Tag, props, value); +}; +/** + * Renders an editable text input in which text formatting is not allowed. + */ + + +/* harmony default export */ var editable_text = (EditableText); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/plain-text/index.js + + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/plain-text/README.md + */ + +const PlainText = (0,external_wp_element_namespaceObject.forwardRef)((_ref, ref) => { + let { + __experimentalVersion, + ...props + } = _ref; + + if (__experimentalVersion === 2) { + return (0,external_wp_element_namespaceObject.createElement)(editable_text, _extends({ + ref: ref + }, props)); + } + + const { + className, + onChange, + ...remainingProps + } = props; + return (0,external_wp_element_namespaceObject.createElement)(lib/* default */.Z, _extends({ + ref: ref, + className: classnames_default()('block-editor-plain-text', className), + onChange: event => onChange(event.target.value) + }, remainingProps)); +}); +/* harmony default export */ var plain_text = (PlainText); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/responsive-block-control/label.js + + +/** + * WordPress dependencies + */ + + + + +function ResponsiveBlockControlLabel(_ref) { + let { + property, + viewport, + desc + } = _ref; + const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ResponsiveBlockControlLabel); + const accessibleLabel = desc || (0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: 1: property name. 2: viewport name. */ + (0,external_wp_i18n_namespaceObject._x)('Controls the %1$s property for %2$s viewports.', 'Text labelling a interface as controlling a given layout property (eg: margin) for a given screen size.'), property, viewport.label); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("span", { + "aria-describedby": `rbc-desc-${instanceId}` + }, viewport.label), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { + as: "span", + id: `rbc-desc-${instanceId}` + }, accessibleLabel)); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/responsive-block-control/index.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + +function ResponsiveBlockControl(props) { + const { + title, + property, + toggleLabel, + onIsResponsiveChange, + renderDefaultControl, + renderResponsiveControls, + isResponsive = false, + defaultLabel = { + id: 'all', + + /* translators: 'Label. Used to signify a layout property (eg: margin, padding) will apply uniformly to all screensizes.' */ + label: (0,external_wp_i18n_namespaceObject.__)('All') + }, + viewports = [{ + id: 'small', + label: (0,external_wp_i18n_namespaceObject.__)('Small screens') + }, { + id: 'medium', + label: (0,external_wp_i18n_namespaceObject.__)('Medium screens') + }, { + id: 'large', + label: (0,external_wp_i18n_namespaceObject.__)('Large screens') + }] + } = props; + + if (!title || !property || !renderDefaultControl) { + return null; + } + + const toggleControlLabel = toggleLabel || (0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: 'Toggle control label. Should the property be the same across all screen sizes or unique per screen size.'. %s property value for the control (eg: margin, padding...etc) */ + (0,external_wp_i18n_namespaceObject.__)('Use the same %s on all screensizes.'), property); + /* translators: 'Help text for the responsive mode toggle control.' */ + + const toggleHelpText = (0,external_wp_i18n_namespaceObject.__)('Toggle between using the same value for all screen sizes or using a unique value per screen size.'); + + const defaultControl = renderDefaultControl((0,external_wp_element_namespaceObject.createElement)(ResponsiveBlockControlLabel, { + property: property, + viewport: defaultLabel + }), defaultLabel); + + const defaultResponsiveControls = () => { + return viewports.map(viewport => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, { + key: viewport.id + }, renderDefaultControl((0,external_wp_element_namespaceObject.createElement)(ResponsiveBlockControlLabel, { + property: property, + viewport: viewport + }), viewport))); + }; + + return (0,external_wp_element_namespaceObject.createElement)("fieldset", { + className: "block-editor-responsive-block-control" + }, (0,external_wp_element_namespaceObject.createElement)("legend", { + className: "block-editor-responsive-block-control__title" + }, title), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-responsive-block-control__inner" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, { + className: "block-editor-responsive-block-control__toggle", + label: toggleControlLabel, + checked: !isResponsive, + onChange: onIsResponsiveChange, + help: toggleHelpText + }), (0,external_wp_element_namespaceObject.createElement)("div", { + className: classnames_default()('block-editor-responsive-block-control__group', { + 'is-responsive': isResponsive + }) + }, !isResponsive && defaultControl, isResponsive && (renderResponsiveControls ? renderResponsiveControls(viewports) : defaultResponsiveControls())))); +} + +/* harmony default export */ var responsive_block_control = (ResponsiveBlockControl); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/shortcut.js +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +function RichTextShortcut(_ref) { + let { + character, + type, + onUse + } = _ref; + const keyboardShortcuts = (0,external_wp_element_namespaceObject.useContext)(keyboardShortcutContext); + const onUseRef = (0,external_wp_element_namespaceObject.useRef)(); + onUseRef.current = onUse; + (0,external_wp_element_namespaceObject.useEffect)(() => { + function callback(event) { + if (external_wp_keycodes_namespaceObject.isKeyboardEvent[type](event, character)) { + onUseRef.current(); + event.preventDefault(); + } + } + + keyboardShortcuts.current.add(callback); + return () => { + keyboardShortcuts.current.delete(callback); + }; + }, [character, type]); + return null; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/toolbar-button.js + + + +/** + * WordPress dependencies + */ + + +function RichTextToolbarButton(_ref) { + let { + name, + shortcutType, + shortcutCharacter, + ...props + } = _ref; + let shortcut; + let fillName = 'RichText.ToolbarControls'; + + if (name) { + fillName += `.${name}`; + } + + if (shortcutType && shortcutCharacter) { + shortcut = external_wp_keycodes_namespaceObject.displayShortcut[shortcutType](shortcutCharacter); + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { + name: fillName + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, _extends({}, props, { + shortcut: shortcut + }))); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/input-event.js +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + +function __unstableRichTextInputEvent(_ref) { + let { + inputType, + onInput + } = _ref; + const callbacks = (0,external_wp_element_namespaceObject.useContext)(inputEventContext); + const onInputRef = (0,external_wp_element_namespaceObject.useRef)(); + onInputRef.current = onInput; + (0,external_wp_element_namespaceObject.useEffect)(() => { + function callback(event) { + if (event.inputType === inputType) { + onInputRef.current(); + event.preventDefault(); + } + } + + callbacks.current.add(callback); + return () => { + callbacks.current.delete(callback); + }; + }, [inputType]); + return null; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/tool-selector/index.js + + + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + +const selectIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + width: "24", + height: "24", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, { + d: "M9.4 20.5L5.2 3.8l14.6 9-2 .3c-.2 0-.4.1-.7.1-.9.2-1.6.3-2.2.5-.8.3-1.4.5-1.8.8-.4.3-.8.8-1.3 1.5-.4.5-.8 1.2-1.2 2l-.3.6-.9 1.9zM7.6 7.1l2.4 9.3c.2-.4.5-.8.7-1.1.6-.8 1.1-1.4 1.6-1.8.5-.4 1.3-.8 2.2-1.1l1.2-.3-8.1-5z" +})); + +function ToolSelector(props, ref) { + const isNavigationTool = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isNavigationMode(), []); + const { + setNavigationMode + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + + const onSwitchMode = mode => { + setNavigationMode(mode === 'edit' ? false : true); + }; + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { + renderToggle: _ref => { + let { + isOpen, + onToggle + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({}, props, { + ref: ref, + icon: isNavigationTool ? selectIcon : library_edit, + "aria-expanded": isOpen, + "aria-haspopup": "true", + onClick: onToggle + /* translators: button label text should, if possible, be under 16 characters. */ + , + label: (0,external_wp_i18n_namespaceObject.__)('Tools') + })); + }, + position: "bottom right", + renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NavigableMenu, { + role: "menu", + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Tools') + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, { + value: isNavigationTool ? 'select' : 'edit', + onSelect: onSwitchMode, + choices: [{ + value: 'edit', + label: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, { + icon: library_edit + }), (0,external_wp_i18n_namespaceObject.__)('Edit')) + }, { + value: 'select', + label: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, selectIcon, (0,external_wp_i18n_namespaceObject.__)('Select')) + }] + })), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-tool-selector__help" + }, (0,external_wp_i18n_namespaceObject.__)('Tools provide different interactions for selecting, navigating, and editing blocks. Toggle between select and edit by pressing Escape and Enter.'))) + }); +} + +/* harmony default export */ var tool_selector = ((0,external_wp_element_namespaceObject.forwardRef)(ToolSelector)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/unit-control/index.js + + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + +function UnitControl(_ref) { + let { + units: unitsProp, + ...props + } = _ref; + const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ + availableUnits: useSetting('spacing.units') || ['%', 'px', 'em', 'rem', 'vw'], + units: unitsProp + }); + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, _extends({ + units: units + }, props)); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-left.js + + +/** + * WordPress dependencies + */ + +const arrowLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M20 10.8H6.7l4.1-4.5-1.1-1.1-5.8 6.3 5.8 5.8 1.1-1.1-4-3.9H20z" +})); +/* harmony default export */ var arrow_left = (arrowLeft); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-input/button.js + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + +class URLInputButton extends external_wp_element_namespaceObject.Component { + constructor() { + super(...arguments); + this.toggle = this.toggle.bind(this); + this.submitLink = this.submitLink.bind(this); + this.state = { + expanded: false + }; + } + + toggle() { + this.setState({ + expanded: !this.state.expanded + }); + } + + submitLink(event) { + event.preventDefault(); + this.toggle(); + } + + render() { + const { + url, + onChange + } = this.props; + const { + expanded + } = this.state; + const buttonLabel = url ? (0,external_wp_i18n_namespaceObject.__)('Edit link') : (0,external_wp_i18n_namespaceObject.__)('Insert link'); + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-url-input__button" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + icon: library_link, + label: buttonLabel, + onClick: this.toggle, + className: "components-toolbar__control", + isPressed: !!url + }), expanded && (0,external_wp_element_namespaceObject.createElement)("form", { + className: "block-editor-url-input__button-modal", + onSubmit: this.submitLink + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-url-input__button-modal-line" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + className: "block-editor-url-input__back", + icon: arrow_left, + label: (0,external_wp_i18n_namespaceObject.__)('Close'), + onClick: this.toggle + }), (0,external_wp_element_namespaceObject.createElement)(url_input, { + value: url || '', + onChange: onChange + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + icon: keyboard_return, + label: (0,external_wp_i18n_namespaceObject.__)('Submit'), + type: "submit" + })))); + } + +} +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-input/README.md + */ + + +/* harmony default export */ var url_input_button = (URLInputButton); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js + + +/** + * WordPress dependencies + */ + +const close_close = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z" +})); +/* harmony default export */ var library_close = (close_close); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/image-url-input-ui.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + +const LINK_DESTINATION_NONE = 'none'; +const LINK_DESTINATION_CUSTOM = 'custom'; +const LINK_DESTINATION_MEDIA = 'media'; +const LINK_DESTINATION_ATTACHMENT = 'attachment'; +const NEW_TAB_REL = ['noreferrer', 'noopener']; +const icon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, { + d: "M0,0h24v24H0V0z", + fill: "none" +}), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, { + d: "m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z" +}), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, { + d: "m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z" +})); + +const ImageURLInputUI = _ref => { + let { + linkDestination, + onChangeUrl, + url, + mediaType = 'image', + mediaUrl, + mediaLink, + linkTarget, + linkClass, + rel + } = _ref; + const [isOpen, setIsOpen] = (0,external_wp_element_namespaceObject.useState)(false); + const openLinkUI = (0,external_wp_element_namespaceObject.useCallback)(() => { + setIsOpen(true); + }); + const [isEditingLink, setIsEditingLink] = (0,external_wp_element_namespaceObject.useState)(false); + const [urlInput, setUrlInput] = (0,external_wp_element_namespaceObject.useState)(null); + const autocompleteRef = (0,external_wp_element_namespaceObject.useRef)(null); + const startEditLink = (0,external_wp_element_namespaceObject.useCallback)(() => { + if (linkDestination === LINK_DESTINATION_MEDIA || linkDestination === LINK_DESTINATION_ATTACHMENT) { + setUrlInput(''); + } + + setIsEditingLink(true); + }); + const stopEditLink = (0,external_wp_element_namespaceObject.useCallback)(() => { + setIsEditingLink(false); + }); + const closeLinkUI = (0,external_wp_element_namespaceObject.useCallback)(() => { + setUrlInput(null); + stopEditLink(); + setIsOpen(false); + }); + + const getUpdatedLinkTargetSettings = value => { + const newLinkTarget = value ? '_blank' : undefined; + let updatedRel; + + if (newLinkTarget) { + const rels = (rel !== null && rel !== void 0 ? rel : '').split(' '); + NEW_TAB_REL.forEach(relVal => { + if (!rels.includes(relVal)) { + rels.push(relVal); + } + }); + updatedRel = rels.join(' '); + } else { + const rels = (rel !== null && rel !== void 0 ? rel : '').split(' ').filter(relVal => NEW_TAB_REL.includes(relVal) === false); + updatedRel = rels.length ? rels.join(' ') : undefined; + } + + return { + linkTarget: newLinkTarget, + rel: updatedRel + }; + }; + + const onFocusOutside = (0,external_wp_element_namespaceObject.useCallback)(() => { + return event => { + // The autocomplete suggestions list renders in a separate popover (in a portal), + // so onFocusOutside fails to detect that a click on a suggestion occurred in the + // LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and + // return to avoid the popover being closed. + const autocompleteElement = autocompleteRef.current; + + if (autocompleteElement && autocompleteElement.contains(event.target)) { + return; + } + + setIsOpen(false); + setUrlInput(null); + stopEditLink(); + }; + }); + const onSubmitLinkChange = (0,external_wp_element_namespaceObject.useCallback)(() => { + return event => { + if (urlInput) { + var _getLinkDestinations$; + + // It is possible the entered URL actually matches a named link destination. + // This check will ensure our link destination is correct. + const selectedDestination = ((_getLinkDestinations$ = getLinkDestinations().find(destination => destination.url === urlInput)) === null || _getLinkDestinations$ === void 0 ? void 0 : _getLinkDestinations$.linkDestination) || LINK_DESTINATION_CUSTOM; + onChangeUrl({ + href: urlInput, + linkDestination: selectedDestination + }); + } + + stopEditLink(); + setUrlInput(null); + event.preventDefault(); + }; + }); + const onLinkRemove = (0,external_wp_element_namespaceObject.useCallback)(() => { + onChangeUrl({ + linkDestination: LINK_DESTINATION_NONE, + href: '' + }); + }); + + const getLinkDestinations = () => { + const linkDestinations = [{ + linkDestination: LINK_DESTINATION_MEDIA, + title: (0,external_wp_i18n_namespaceObject.__)('Media File'), + url: mediaType === 'image' ? mediaUrl : undefined, + icon + }]; + + if (mediaType === 'image' && mediaLink) { + linkDestinations.push({ + linkDestination: LINK_DESTINATION_ATTACHMENT, + title: (0,external_wp_i18n_namespaceObject.__)('Attachment Page'), + url: mediaType === 'image' ? mediaLink : undefined, + icon: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, { + d: "M0 0h24v24H0V0z", + fill: "none" + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, { + d: "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z" + })) + }); + } + + return linkDestinations; + }; + + const onSetHref = value => { + const linkDestinations = getLinkDestinations(); + let linkDestinationInput; + + if (!value) { + linkDestinationInput = LINK_DESTINATION_NONE; + } else { + linkDestinationInput = ((0,external_lodash_namespaceObject.find)(linkDestinations, destination => { + return destination.url === value; + }) || { + linkDestination: LINK_DESTINATION_CUSTOM + }).linkDestination; + } + + onChangeUrl({ + linkDestination: linkDestinationInput, + href: value + }); + }; + + const onSetNewTab = value => { + const updatedLinkTarget = getUpdatedLinkTargetSettings(value); + onChangeUrl(updatedLinkTarget); + }; + + const onSetLinkRel = value => { + onChangeUrl({ + rel: value + }); + }; + + const onSetLinkClass = value => { + onChangeUrl({ + linkClass: value + }); + }; + + const advancedOptions = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Open in new tab'), + onChange: onSetNewTab, + checked: linkTarget === '_blank' + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Link Rel'), + value: rel !== null && rel !== void 0 ? rel : '', + onChange: onSetLinkRel + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Link CSS Class'), + value: linkClass || '', + onChange: onSetLinkClass + })); + const linkEditorValue = urlInput !== null ? urlInput : url; + const urlLabel = ((0,external_lodash_namespaceObject.find)(getLinkDestinations(), ['linkDestination', linkDestination]) || {}).title; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + icon: library_link, + className: "components-toolbar__control", + label: url ? (0,external_wp_i18n_namespaceObject.__)('Edit link') : (0,external_wp_i18n_namespaceObject.__)('Insert link'), + "aria-expanded": isOpen, + onClick: openLinkUI + }), isOpen && (0,external_wp_element_namespaceObject.createElement)(url_popover, { + onFocusOutside: onFocusOutside(), + onClose: closeLinkUI, + renderSettings: () => advancedOptions, + additionalControls: !linkEditorValue && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NavigableMenu, null, (0,external_lodash_namespaceObject.map)(getLinkDestinations(), link => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + key: link.linkDestination, + icon: link.icon, + onClick: () => { + setUrlInput(null); + onSetHref(link.url); + stopEditLink(); + } + }, link.title))) + }, (!url || isEditingLink) && (0,external_wp_element_namespaceObject.createElement)(url_popover.LinkEditor, { + className: "block-editor-format-toolbar__link-container-content", + value: linkEditorValue, + onChangeInputValue: setUrlInput, + onSubmit: onSubmitLinkChange(), + autocompleteRef: autocompleteRef + }), url && !isEditingLink && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(url_popover.LinkViewer, { + className: "block-editor-format-toolbar__link-container-content", + url: url, + onEditLinkClick: startEditLink, + urlLabel: urlLabel + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + icon: library_close, + label: (0,external_wp_i18n_namespaceObject.__)('Remove link'), + onClick: onLinkRemove + })))); +}; + + + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/preview-options/index.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + +function PreviewOptions(_ref) { + let { + children, + className, + isEnabled = true, + deviceType, + setDeviceType + } = _ref; + const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<'); + if (isMobile) return null; + const popoverProps = { + className: classnames_default()(className, 'block-editor-post-preview__dropdown-content'), + position: 'bottom left' + }; + const toggleProps = { + variant: 'tertiary', + className: 'block-editor-post-preview__button-toggle', + disabled: !isEnabled, + + /* translators: button label text should, if possible, be under 16 characters. */ + children: (0,external_wp_i18n_namespaceObject.__)('Preview') + }; + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, { + className: "block-editor-post-preview__dropdown", + popoverProps: popoverProps, + toggleProps: toggleProps, + icon: null + }, () => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + className: "block-editor-post-preview__button-resize", + onClick: () => setDeviceType('Desktop'), + icon: deviceType === 'Desktop' && library_check + }, (0,external_wp_i18n_namespaceObject.__)('Desktop')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + className: "block-editor-post-preview__button-resize", + onClick: () => setDeviceType('Tablet'), + icon: deviceType === 'Tablet' && library_check + }, (0,external_wp_i18n_namespaceObject.__)('Tablet')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + className: "block-editor-post-preview__button-resize", + onClick: () => setDeviceType('Mobile'), + icon: deviceType === 'Mobile' && library_check + }, (0,external_wp_i18n_namespaceObject.__)('Mobile'))), children)); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-resize-canvas/index.js +/** + * WordPress dependencies + */ + +/** + * Function to resize the editor window. + * + * @param {string} deviceType Used for determining the size of the container (e.g. Desktop, Tablet, Mobile) + * + * @return {Object} Inline styles to be added to resizable container. + */ + +function useResizeCanvas(deviceType) { + const [actualWidth, updateActualWidth] = (0,external_wp_element_namespaceObject.useState)(window.innerWidth); + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (deviceType === 'Desktop') { + return; + } + + const resizeListener = () => updateActualWidth(window.innerWidth); + + window.addEventListener('resize', resizeListener); + return () => { + window.removeEventListener('resize', resizeListener); + }; + }, [deviceType]); + + const getCanvasWidth = device => { + let deviceWidth; + + switch (device) { + case 'Tablet': + deviceWidth = 780; + break; + + case 'Mobile': + deviceWidth = 360; + break; + + default: + return null; + } + + return deviceWidth < actualWidth ? deviceWidth : actualWidth; + }; + + const marginValue = () => window.innerHeight < 800 ? 36 : 72; + + const contentInlineStyles = device => { + const height = device === 'Mobile' ? '768px' : '1024px'; + + switch (device) { + case 'Tablet': + case 'Mobile': + return { + width: getCanvasWidth(device), + margin: marginValue() + 'px auto', + height, + borderRadius: '2px 2px 2px 2px', + border: '1px solid #ddd', + overflowY: 'auto' + }; + + default: + return null; + } + }; + + return contentInlineStyles(deviceType); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/skip-to-selected-block/index.js + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + +const SkipToSelectedBlock = _ref => { + let { + selectedBlockClientId + } = _ref; + const ref = useBlockRef(selectedBlockClientId); + + const onClick = () => { + ref.current.focus(); + }; + + return selectedBlockClientId ? (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + variant: "secondary", + className: "block-editor-skip-to-selected-block", + onClick: onClick + }, (0,external_wp_i18n_namespaceObject.__)('Skip to the selected block')) : null; +}; +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/skip-to-selected-block/README.md + */ + + +/* harmony default export */ var skip_to_selected_block = ((0,external_wp_data_namespaceObject.withSelect)(select => { + return { + selectedBlockClientId: select(store).getBlockSelectionStart() + }; +})(SkipToSelectedBlock)); + +;// CONCATENATED MODULE: external ["wp","wordcount"] +var external_wp_wordcount_namespaceObject = window["wp"]["wordcount"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/multi-selection-inspector/index.js + + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + + +function MultiSelectionInspector(_ref) { + let { + blocks + } = _ref; + const words = (0,external_wp_wordcount_namespaceObject.count)((0,external_wp_blocks_namespaceObject.serialize)(blocks), 'words'); + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-multi-selection-inspector__card" + }, (0,external_wp_element_namespaceObject.createElement)(block_icon, { + icon: library_copy, + showColors: true + }), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-multi-selection-inspector__card-content" + }, (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-multi-selection-inspector__card-title" + }, (0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %d: number of blocks */ + (0,external_wp_i18n_namespaceObject._n)('%d block', '%d blocks', blocks.length), blocks.length)), (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-multi-selection-inspector__card-description" + }, (0,external_wp_i18n_namespaceObject.sprintf)( + /* translators: %d: number of words */ + (0,external_wp_i18n_namespaceObject._n)('%d word', '%d words', words), words)))); +} + +/* harmony default export */ var multi_selection_inspector = ((0,external_wp_data_namespaceObject.withSelect)(select => { + const { + getMultiSelectedBlocks + } = select(store); + return { + blocks: getMultiSelectedBlocks() + }; +})(MultiSelectionInspector)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/default-style-picker/index.js + + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + +function DefaultStylePicker(_ref) { + let { + blockName + } = _ref; + const { + preferredStyle, + onUpdatePreferredStyleVariations, + styles + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + var _preferredStyleVariat, _preferredStyleVariat2; + + const settings = select(store).getSettings(); + const preferredStyleVariations = settings.__experimentalPreferredStyleVariations; + return { + preferredStyle: preferredStyleVariations === null || preferredStyleVariations === void 0 ? void 0 : (_preferredStyleVariat = preferredStyleVariations.value) === null || _preferredStyleVariat === void 0 ? void 0 : _preferredStyleVariat[blockName], + onUpdatePreferredStyleVariations: (_preferredStyleVariat2 = preferredStyleVariations === null || preferredStyleVariations === void 0 ? void 0 : preferredStyleVariations.onChange) !== null && _preferredStyleVariat2 !== void 0 ? _preferredStyleVariat2 : null, + styles: select(external_wp_blocks_namespaceObject.store).getBlockStyles(blockName) + }; + }, [blockName]); + const selectOptions = (0,external_wp_element_namespaceObject.useMemo)(() => [{ + label: (0,external_wp_i18n_namespaceObject.__)('Not set'), + value: '' + }, ...styles.map(_ref2 => { + let { + label, + name + } = _ref2; + return { + label, + value: name + }; + })], [styles]); + const defaultStyleName = (0,external_wp_element_namespaceObject.useMemo)(() => { + var _getDefaultStyle; + + return (_getDefaultStyle = getDefaultStyle(styles)) === null || _getDefaultStyle === void 0 ? void 0 : _getDefaultStyle.name; + }, [styles]); + const selectOnChange = (0,external_wp_element_namespaceObject.useCallback)(blockStyle => { + onUpdatePreferredStyleVariations(blockName, blockStyle); + }, [blockName, onUpdatePreferredStyleVariations]); // Until the functionality is migrated to global styles, + // only show the default style picker if a non-default style has already been selected. + + if (!preferredStyle || preferredStyle === defaultStyleName) { + return null; + } + + return onUpdatePreferredStyleVariations && (0,external_wp_element_namespaceObject.createElement)("div", { + className: "default-style-picker__default-switcher" + }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, { + options: selectOptions, + value: preferredStyle || '', + label: (0,external_wp_i18n_namespaceObject.__)('Default Style'), + onChange: selectOnChange + })); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-inspector/index.js + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + + + + + + + + +const BlockInspector = _ref => { + let { + showNoBlockSelectedMessage = true + } = _ref; + const { + count, + hasBlockStyles, + selectedBlockName, + selectedBlockClientId, + blockType + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getSelectedBlockClientId, + getSelectedBlockCount, + getBlockName + } = select(store); + const { + getBlockStyles + } = select(external_wp_blocks_namespaceObject.store); + + const _selectedBlockClientId = getSelectedBlockClientId(); + + const _selectedBlockName = _selectedBlockClientId && getBlockName(_selectedBlockClientId); + + const _blockType = _selectedBlockName && (0,external_wp_blocks_namespaceObject.getBlockType)(_selectedBlockName); + + const blockStyles = _selectedBlockName && getBlockStyles(_selectedBlockName); + + return { + count: getSelectedBlockCount(), + selectedBlockClientId: _selectedBlockClientId, + selectedBlockName: _selectedBlockName, + blockType: _blockType, + hasBlockStyles: blockStyles && blockStyles.length > 0 + }; + }, []); + + if (count > 1) { + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-inspector" + }, (0,external_wp_element_namespaceObject.createElement)(multi_selection_inspector, null), (0,external_wp_element_namespaceObject.createElement)(inspector_controls.Slot, null), (0,external_wp_element_namespaceObject.createElement)(inspector_controls.Slot, { + __experimentalGroup: "color", + label: (0,external_wp_i18n_namespaceObject.__)('Color'), + className: "color-block-support-panel__inner-wrapper" + }), (0,external_wp_element_namespaceObject.createElement)(inspector_controls.Slot, { + __experimentalGroup: "typography", + label: (0,external_wp_i18n_namespaceObject.__)('Typography') + }), (0,external_wp_element_namespaceObject.createElement)(inspector_controls.Slot, { + __experimentalGroup: "dimensions", + label: (0,external_wp_i18n_namespaceObject.__)('Dimensions') + }), (0,external_wp_element_namespaceObject.createElement)(inspector_controls.Slot, { + __experimentalGroup: "border", + label: (0,external_wp_i18n_namespaceObject.__)('Border') + })); + } + + const isSelectedBlockUnregistered = selectedBlockName === (0,external_wp_blocks_namespaceObject.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) { + if (showNoBlockSelectedMessage) { + return (0,external_wp_element_namespaceObject.createElement)("span", { + className: "block-editor-block-inspector__no-blocks" + }, (0,external_wp_i18n_namespaceObject.__)('No block selected.')); + } + + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)(BlockInspectorSingleBlock, { + clientId: selectedBlockClientId, + blockName: blockType.name, + hasBlockStyles: hasBlockStyles + }); +}; + +const BlockInspectorSingleBlock = _ref2 => { + let { + clientId, + blockName, + hasBlockStyles + } = _ref2; + const blockInformation = useBlockDisplayInformation(clientId); + return (0,external_wp_element_namespaceObject.createElement)("div", { + className: "block-editor-block-inspector" + }, (0,external_wp_element_namespaceObject.createElement)(block_card, blockInformation), (0,external_wp_element_namespaceObject.createElement)(block_variation_transforms, { + blockClientId: clientId + }), hasBlockStyles && (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { + title: (0,external_wp_i18n_namespaceObject.__)('Styles') + }, (0,external_wp_element_namespaceObject.createElement)(block_styles, { + scope: "core/block-inspector", + clientId: clientId + }), (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'defaultStylePicker', true) && (0,external_wp_element_namespaceObject.createElement)(DefaultStylePicker, { + blockName: blockName + }))), (0,external_wp_element_namespaceObject.createElement)(inspector_controls.Slot, null), (0,external_wp_element_namespaceObject.createElement)(inspector_controls.Slot, { + __experimentalGroup: "color", + label: (0,external_wp_i18n_namespaceObject.__)('Color'), + className: "color-block-support-panel__inner-wrapper" + }), (0,external_wp_element_namespaceObject.createElement)(inspector_controls.Slot, { + __experimentalGroup: "typography", + label: (0,external_wp_i18n_namespaceObject.__)('Typography') + }), (0,external_wp_element_namespaceObject.createElement)(inspector_controls.Slot, { + __experimentalGroup: "dimensions", + label: (0,external_wp_i18n_namespaceObject.__)('Dimensions') + }), (0,external_wp_element_namespaceObject.createElement)(inspector_controls.Slot, { + __experimentalGroup: "border", + label: (0,external_wp_i18n_namespaceObject.__)('Border') + }), (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_element_namespaceObject.createElement)(AdvancedControls, null)), (0,external_wp_element_namespaceObject.createElement)(skip_to_selected_block, { + key: "back" + })); +}; + +const AdvancedControls = () => { + const slot = (0,external_wp_components_namespaceObject.__experimentalUseSlot)(InspectorAdvancedControls.slotName); + const hasFills = Boolean(slot.fills && slot.fills.length); + + if (!hasFills) { + return null; + } + + return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { + className: "block-editor-block-inspector__advanced", + title: (0,external_wp_i18n_namespaceObject.__)('Advanced'), + initialOpen: false + }, (0,external_wp_element_namespaceObject.createElement)(inspector_controls.Slot, { + __experimentalGroup: "advanced" + })); +}; +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-inspector/README.md + */ + + +/* harmony default export */ var block_inspector = (BlockInspector); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/index.js + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + + + + +/** + * Renders block tools (the block toolbar, select/navigation mode toolbar, the + * insertion point and a slot for the inline rich text toolbar). Must be wrapped + * around the block content and editor styles wrapper or iframe. + * + * @param {Object} $0 Props. + * @param {Object} $0.children The block content and style container. + * @param {Object} $0.__unstableContentRef Ref holding the content scroll container. + */ + +function BlockTools(_ref) { + let { + children, + __unstableContentRef, + ...props + } = _ref; + const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); + const hasFixedToolbar = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().hasFixedToolbar, []); + const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)(); + const { + getSelectedBlockClientIds, + getBlockRootClientId + } = (0,external_wp_data_namespaceObject.useSelect)(store); const { duplicateBlocks, removeBlocks, @@ -37880,84 +48586,160 @@ clearSelectedBlock, moveBlocksUp, moveBlocksDown - } = Object(external_wp_data_["useDispatch"])(store); // Moves selected block/blocks up - - Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/move-up', Object(external_wp_element_["useCallback"])(event => { - event.preventDefault(); - moveBlocksUp(clientIds, rootClientId); - }, [clientIds, moveBlocksUp]), { - bindGlobal: true, - isDisabled: clientIds.length === 0 - }); // Moves selected block/blocks up - - Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/move-down', Object(external_wp_element_["useCallback"])(event => { - event.preventDefault(); - moveBlocksDown(clientIds, rootClientId); - }, [clientIds, moveBlocksDown]), { - bindGlobal: true, - isDisabled: clientIds.length === 0 - }); // Prevents bookmark all Tabs shortcut in Chrome when devtools are closed. - // Prevents reposition Chrome devtools pane shortcut when devtools are open. - - Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/duplicate', Object(external_wp_element_["useCallback"])(event => { - event.preventDefault(); - duplicateBlocks(clientIds); - }, [clientIds, duplicateBlocks]), { - bindGlobal: true, - isDisabled: clientIds.length === 0 - }); // Does not clash with any known browser/native shortcuts, but preventDefault - // is used to prevent any obscure unknown shortcuts from triggering. - - Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/remove', Object(external_wp_element_["useCallback"])(event => { - event.preventDefault(); - removeBlocks(clientIds); - }, [clientIds, removeBlocks]), { - bindGlobal: true, - isDisabled: clientIds.length === 0 - }); // Does not clash with any known browser/native shortcuts, but preventDefault - // is used to prevent any obscure unknown shortcuts from triggering. - - Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/insert-after', Object(external_wp_element_["useCallback"])(event => { - event.preventDefault(); - insertAfterBlock(Object(external_lodash_["last"])(clientIds)); - }, [clientIds, insertAfterBlock]), { - bindGlobal: true, - isDisabled: clientIds.length === 0 - }); // Prevent 'view recently closed tabs' in Opera using preventDefault. - - Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/insert-before', Object(external_wp_element_["useCallback"])(event => { - event.preventDefault(); - insertBeforeBlock(Object(external_lodash_["first"])(clientIds)); - }, [clientIds, insertBeforeBlock]), { - bindGlobal: true, - isDisabled: clientIds.length === 0 - }); - Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/delete-multi-selection', Object(external_wp_element_["useCallback"])(event => { - event.preventDefault(); - removeBlocks(clientIds); - }, [clientIds, removeBlocks]), { - isDisabled: clientIds.length < 2 - }); - Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/unselect', Object(external_wp_element_["useCallback"])(event => { - event.preventDefault(); - clearSelectedBlock(); - event.target.ownerDocument.defaultView.getSelection().removeAllRanges(); - }, [clientIds, clearSelectedBlock]), { - isDisabled: clientIds.length < 2 - }); + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + + function onKeyDown(event) { + if (isMatch('core/block-editor/move-up', event)) { + const clientIds = getSelectedBlockClientIds(); + + if (clientIds.length) { + event.preventDefault(); + const rootClientId = getBlockRootClientId((0,external_lodash_namespaceObject.first)(clientIds)); + moveBlocksUp(clientIds, rootClientId); + } + } else if (isMatch('core/block-editor/move-down', event)) { + const clientIds = getSelectedBlockClientIds(); + + if (clientIds.length) { + event.preventDefault(); + const rootClientId = getBlockRootClientId((0,external_lodash_namespaceObject.first)(clientIds)); + moveBlocksDown(clientIds, rootClientId); + } + } else if (isMatch('core/block-editor/duplicate', event)) { + const clientIds = getSelectedBlockClientIds(); + + if (clientIds.length) { + event.preventDefault(); + duplicateBlocks(clientIds); + } + } else if (isMatch('core/block-editor/remove', event)) { + const clientIds = getSelectedBlockClientIds(); + + if (clientIds.length) { + event.preventDefault(); + removeBlocks(clientIds); + } + } else if (isMatch('core/block-editor/insert-after', event)) { + const clientIds = getSelectedBlockClientIds(); + + if (clientIds.length) { + event.preventDefault(); + insertAfterBlock((0,external_lodash_namespaceObject.last)(clientIds)); + } + } else if (isMatch('core/block-editor/insert-before', event)) { + const clientIds = getSelectedBlockClientIds(); + + if (clientIds.length) { + event.preventDefault(); + insertBeforeBlock((0,external_lodash_namespaceObject.first)(clientIds)); + } + } else if (isMatch('core/block-editor/unselect', event)) { + const clientIds = getSelectedBlockClientIds(); + + if (clientIds.length > 1) { + event.preventDefault(); + clearSelectedBlock(); + event.target.ownerDocument.defaultView.getSelection().removeAllRanges(); + } + } + } + + return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions + (0,external_wp_element_namespaceObject.createElement)("div", _extends({}, props, { + onKeyDown: onKeyDown + }), (0,external_wp_element_namespaceObject.createElement)(InsertionPoint, { + __unstableContentRef: __unstableContentRef + }, (hasFixedToolbar || !isLargeViewport) && (0,external_wp_element_namespaceObject.createElement)(block_contextual_toolbar, { + isFixed: true + }), (0,external_wp_element_namespaceObject.createElement)(WrappedBlockPopover, { + __unstableContentRef: __unstableContentRef + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover.Slot, { + name: "block-toolbar", + ref: usePopoverScroll(__unstableContentRef) + }), children, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover.Slot, { + name: "__unstable-block-tools-after", + ref: usePopoverScroll(__unstableContentRef) + }))) + ); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/library.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + +function InserterLibrary(_ref, ref) { + let { + rootClientId, + clientId, + isAppender, + showInserterHelpPanel, + showMostUsedBlocks = false, + __experimentalInsertionIndex, + __experimentalFilterValue, + onSelect = external_lodash_namespaceObject.noop, + shouldFocusBlock = false + } = _ref; + const destinationRootClientId = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getBlockRootClientId + } = select(store); + return rootClientId || getBlockRootClientId(clientId) || undefined; + }, [clientId, rootClientId]); + return (0,external_wp_element_namespaceObject.createElement)(menu, { + onSelect: onSelect, + rootClientId: destinationRootClientId, + clientId: clientId, + isAppender: isAppender, + showInserterHelpPanel: showInserterHelpPanel, + showMostUsedBlocks: showMostUsedBlocks, + __experimentalInsertionIndex: __experimentalInsertionIndex, + __experimentalFilterValue: __experimentalFilterValue, + shouldFocusBlock: shouldFocusBlock, + ref: ref + }); +} + +/* harmony default export */ var library = ((0,external_wp_element_namespaceObject.forwardRef)(InserterLibrary)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/keyboard-shortcuts/index.js +/** + * WordPress dependencies + */ + + + + + +function KeyboardShortcuts() { return null; } function KeyboardShortcutsRegister() { - // Registering the shortcuts + // Registering the shortcuts. const { registerShortcut - } = Object(external_wp_data_["useDispatch"])(external_wp_keyboardShortcuts_["store"]); - Object(external_wp_element_["useEffect"])(() => { + } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); + (0,external_wp_element_namespaceObject.useEffect)(() => { registerShortcut({ name: 'core/block-editor/duplicate', category: 'block', - description: Object(external_wp_i18n_["__"])('Duplicate the selected block(s).'), + description: (0,external_wp_i18n_namespaceObject.__)('Duplicate the selected block(s).'), keyCombination: { modifier: 'primaryShift', character: 'd' @@ -37966,7 +48748,7 @@ registerShortcut({ name: 'core/block-editor/remove', category: 'block', - description: Object(external_wp_i18n_["__"])('Remove the selected block(s).'), + description: (0,external_wp_i18n_namespaceObject.__)('Remove the selected block(s).'), keyCombination: { modifier: 'access', character: 'z' @@ -37975,7 +48757,7 @@ registerShortcut({ name: 'core/block-editor/insert-before', category: 'block', - description: Object(external_wp_i18n_["__"])('Insert a new block before the selected block(s).'), + description: (0,external_wp_i18n_namespaceObject.__)('Insert a new block before the selected block(s).'), keyCombination: { modifier: 'primaryAlt', character: 't' @@ -37984,7 +48766,7 @@ registerShortcut({ name: 'core/block-editor/insert-after', category: 'block', - description: Object(external_wp_i18n_["__"])('Insert a new block after the selected block(s).'), + description: (0,external_wp_i18n_namespaceObject.__)('Insert a new block after the selected block(s).'), keyCombination: { modifier: 'primaryAlt', character: 'y' @@ -37993,7 +48775,7 @@ registerShortcut({ name: 'core/block-editor/delete-multi-selection', category: 'block', - description: Object(external_wp_i18n_["__"])('Remove multiple selected blocks.'), + description: (0,external_wp_i18n_namespaceObject.__)('Delete selection.'), keyCombination: { character: 'del' }, @@ -38004,7 +48786,7 @@ registerShortcut({ name: 'core/block-editor/select-all', category: 'selection', - description: Object(external_wp_i18n_["__"])('Select all text when typing. Press again to select all blocks.'), + description: (0,external_wp_i18n_namespaceObject.__)('Select all text when typing. Press again to select all blocks.'), keyCombination: { modifier: 'primary', character: 'a' @@ -38013,7 +48795,7 @@ registerShortcut({ name: 'core/block-editor/unselect', category: 'selection', - description: Object(external_wp_i18n_["__"])('Clear selection.'), + description: (0,external_wp_i18n_namespaceObject.__)('Clear selection.'), keyCombination: { character: 'escape' } @@ -38021,7 +48803,7 @@ registerShortcut({ name: 'core/block-editor/focus-toolbar', category: 'global', - description: Object(external_wp_i18n_["__"])('Navigate to the nearest toolbar.'), + description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the nearest toolbar.'), keyCombination: { modifier: 'alt', character: 'F10' @@ -38030,7 +48812,7 @@ registerShortcut({ name: 'core/block-editor/move-up', category: 'block', - description: Object(external_wp_i18n_["__"])('Move the selected block(s) up.'), + description: (0,external_wp_i18n_namespaceObject.__)('Move the selected block(s) up.'), keyCombination: { modifier: 'secondary', character: 't' @@ -38039,7 +48821,7 @@ registerShortcut({ name: 'core/block-editor/move-down', category: 'block', - description: Object(external_wp_i18n_["__"])('Move the selected block(s) down.'), + description: (0,external_wp_i18n_namespaceObject.__)('Move the selected block(s) down.'), keyCombination: { modifier: 'secondary', character: 'y' @@ -38052,7 +48834,7 @@ KeyboardShortcuts.Register = KeyboardShortcutsRegister; /* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts); -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/selection-scroll-into-view/index.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/selection-scroll-into-view/index.js /** * WordPress dependencies */ @@ -38066,12 +48848,13 @@ function MultiSelectScrollIntoView() { external_wp_deprecated_default()('wp.blockEditor.MultiSelectScrollIntoView', { - hint: 'This behaviour is now built-in.' + hint: 'This behaviour is now built-in.', + since: '5.8' }); return null; } -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/observe-typing/index.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/observe-typing/index.js /** @@ -38092,7 +48875,7 @@ * @type {Set} */ -const KEY_DOWN_ELIGIBLE_KEY_CODES = new Set([external_wp_keycodes_["UP"], external_wp_keycodes_["RIGHT"], external_wp_keycodes_["DOWN"], external_wp_keycodes_["LEFT"], external_wp_keycodes_["ENTER"], external_wp_keycodes_["BACKSPACE"]]); +const KEY_DOWN_ELIGIBLE_KEY_CODES = new Set([external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.RIGHT, external_wp_keycodes_namespaceObject.DOWN, external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.ENTER, external_wp_keycodes_namespaceObject.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 @@ -38117,11 +48900,11 @@ function useMouseMoveTypingReset() { - const isTyping = Object(external_wp_data_["useSelect"])(select => select(store).isTyping()); + const isTyping = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isTyping(), []); const { stopTyping - } = Object(external_wp_data_["useDispatch"])(store); - return Object(external_wp_compose_["useRefEffect"])(node => { + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { if (!isTyping) { return; } @@ -38167,13 +48950,13 @@ */ function useTypingObserver() { - const isTyping = Object(external_wp_data_["useSelect"])(select => select(store).isTyping()); + const isTyping = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isTyping()); const { startTyping, stopTyping - } = Object(external_wp_data_["useDispatch"])(store); + } = (0,external_wp_data_namespaceObject.useDispatch)(store); const ref1 = useMouseMoveTypingReset(); - const ref2 = Object(external_wp_compose_["useRefEffect"])(node => { + const ref2 = (0,external_wp_compose_namespaceObject.useRefEffect)(node => { const { ownerDocument } = node; @@ -38199,7 +48982,7 @@ // typing will re-start. timerId = defaultView.setTimeout(() => { - if (!Object(external_wp_dom_["isTextField"])(target)) { + if (!(0,external_wp_dom_namespaceObject.isTextField)(target)) { stopTyping(); } }); @@ -38218,7 +49001,7 @@ keyCode } = event; - if (keyCode === external_wp_keycodes_["ESCAPE"] || keyCode === external_wp_keycodes_["TAB"]) { + if (keyCode === external_wp_keycodes_namespaceObject.ESCAPE || keyCode === external_wp_keycodes_namespaceObject.TAB) { stopTyping(); } } @@ -38263,7 +49046,7 @@ // text field (e.g. arrow-ing through toolbar buttons). // Ignore typing if outside the current DOM container - if (!Object(external_wp_dom_["isTextField"])(target) || !node.contains(target)) { + if (!(0,external_wp_dom_namespaceObject.isTextField)(target) || !node.contains(target)) { return; } // Special-case keydown because certain keys do not emit a keypress // event. Conversely avoid keydown as the canonical event since @@ -38285,13 +49068,14 @@ node.removeEventListener('keydown', startTypingInTextField); }; }, [isTyping, startTyping, stopTyping]); - return Object(external_wp_compose_["useMergeRefs"])([ref1, ref2]); -} - -function ObserveTyping({ - children -}) { - return Object(external_wp_element_["createElement"])("div", { + return (0,external_wp_compose_namespaceObject.useMergeRefs)([ref1, ref2]); +} + +function ObserveTyping(_ref) { + let { + children + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)("div", { ref: useTypingObserver() }, children); } @@ -38302,20 +49086,7 @@ /* harmony default export */ var observe_typing = (ObserveTyping); -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/preserve-scroll-in-reorder/index.js -/** - * WordPress dependencies - */ - -function PreserveScrollInReorder() { - external_wp_deprecated_default()('PreserveScrollInReorder component', { - since: '5.4', - hint: 'This behavior is now built-in the block list' - }); - return null; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/typewriter/index.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/typewriter/index.js /** @@ -38331,11 +49102,11 @@ const isIE = window.navigator.userAgent.indexOf('Trident') !== -1; -const arrowKeyCodes = new Set([external_wp_keycodes_["UP"], external_wp_keycodes_["DOWN"], external_wp_keycodes_["LEFT"], external_wp_keycodes_["RIGHT"]]); +const arrowKeyCodes = new Set([external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.DOWN, external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.RIGHT]); const initialTriggerPercentage = 0.75; function useTypewriter() { - const hasSelectedBlock = Object(external_wp_data_["useSelect"])(select => select(store).hasSelectedBlock()); - return Object(external_wp_compose_["useRefEffect"])(node => { + const hasSelectedBlock = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).hasSelectedBlock(), []); + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { if (!hasSelectedBlock) { return; } @@ -38381,14 +49152,16 @@ */ - function maintainCaretPosition({ - keyCode - }) { + function maintainCaretPosition(_ref) { + let { + keyCode + } = _ref; + if (!isSelectionEligibleForScroll()) { return; } - const currentCaretRect = Object(external_wp_dom_["computeCaretRect"])(defaultView); + const currentCaretRect = (0,external_wp_dom_namespaceObject.computeCaretRect)(defaultView); if (!currentCaretRect) { return; @@ -38416,7 +49189,7 @@ return; } - const scrollContainer = Object(external_wp_dom_["getScrollContainer"])(node); // The page must be scrollable. + const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(node); // The page must be scrollable. if (!scrollContainer) { return; @@ -38481,7 +49254,7 @@ function computeCaretRectangle() { if (isSelectionEligibleForScroll()) { - caretRect = Object(external_wp_dom_["computeCaretRect"])(defaultView); + caretRect = (0,external_wp_dom_namespaceObject.computeCaretRect)(defaultView); } } /** @@ -38524,10 +49297,11 @@ }, [hasSelectedBlock]); } -function Typewriter({ - children -}) { - return Object(external_wp_element_["createElement"])("div", { +function Typewriter(_ref2) { + let { + children + } = _ref2; + return (0,external_wp_element_namespaceObject.createElement)("div", { ref: useTypewriter(), className: "block-editor__typewriter" }, children); @@ -38550,1086 +49324,25 @@ /* harmony default export */ var typewriter = (TypewriterOrIEBypass); -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-multi-selection.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - - -function use_multi_selection_toggleRichText(container, toggle) { - Array.from(container.querySelectorAll('.rich-text')).forEach(node => { - if (toggle) { - node.setAttribute('contenteditable', true); - } else { - node.removeAttribute('contenteditable'); - } - }); -} -/** - * Returns for the deepest node at the start or end of a container node. Ignores - * any text nodes that only contain HTML formatting whitespace. - * - * @param {Element} node Container to search. - * @param {string} type 'start' or 'end'. - */ - - -function getDeepestNode(node, type) { - const child = type === 'start' ? 'firstChild' : 'lastChild'; - const sibling = type === 'start' ? 'nextSibling' : 'previousSibling'; - - while (node[child]) { - node = node[child]; - - while (node.nodeType === node.TEXT_NODE && /^[ \t\n]*$/.test(node.data) && node[sibling]) { - node = node[sibling]; - } - } - - return node; -} - -function use_multi_selection_selector(select) { - const { - isMultiSelecting, - getMultiSelectedBlockClientIds, - hasMultiSelection, - getSelectedBlockClientId - } = select(store); - return { - isMultiSelecting: isMultiSelecting(), - multiSelectedBlockClientIds: getMultiSelectedBlockClientIds(), - hasMultiSelection: hasMultiSelection(), - selectedBlockClientId: getSelectedBlockClientId() - }; -} - -function use_multi_selection_useMultiSelection() { - const ref = Object(external_wp_element_["useRef"])(); - const { - isMultiSelecting, - multiSelectedBlockClientIds, - hasMultiSelection, - selectedBlockClientId - } = Object(external_wp_data_["useSelect"])(use_multi_selection_selector, []); - const { - selectBlock - } = Object(external_wp_data_["useDispatch"])(store); - const selectedRef = useBlockRef(selectedBlockClientId); // These must be in the right DOM order. - - const startRef = useBlockRef(Object(external_lodash_["first"])(multiSelectedBlockClientIds)); - const endRef = useBlockRef(Object(external_lodash_["last"])(multiSelectedBlockClientIds)); - /** - * When the component updates, and there is multi selection, we need to - * select the entire block contents. - */ - - Object(external_wp_element_["useEffect"])(() => { - const { - ownerDocument - } = ref.current; - const { - defaultView - } = ownerDocument; - - if (!hasMultiSelection || isMultiSelecting) { - if (!selectedBlockClientId || isMultiSelecting) { - return; - } - - const selection = defaultView.getSelection(); - - if (selection.rangeCount && !selection.isCollapsed) { - const blockNode = selectedRef.current; - const { - startContainer, - endContainer - } = selection.getRangeAt(0); - - if (!!blockNode && (!blockNode.contains(startContainer) || !blockNode.contains(endContainer))) { - selection.removeAllRanges(); - } - } - - return; - } - - const { - length - } = multiSelectedBlockClientIds; - - if (length < 2) { - return; - } // For some browsers, like Safari, it is important that focus happens - // BEFORE selection. - - - ref.current.focus(); - const selection = defaultView.getSelection(); - const range = ownerDocument.createRange(); // These must be in the right DOM order. - // The most stable way to select the whole block contents is to start - // and end at the deepest points. - - const startNode = getDeepestNode(startRef.current, 'start'); - const endNode = getDeepestNode(endRef.current, 'end'); // While rich text will be disabled with a delay when there is a multi - // selection, we must do it immediately because it's not possible to set - // selection across editable hosts. - - use_multi_selection_toggleRichText(ref.current, false); - range.setStartBefore(startNode); - range.setEndAfter(endNode); - selection.removeAllRanges(); - selection.addRange(range); - }, [hasMultiSelection, isMultiSelecting, multiSelectedBlockClientIds, selectBlock, selectedBlockClientId]); - return ref; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-tab-nav.js - - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - -function isFormElement(element) { - const { - tagName - } = element; - return tagName === 'INPUT' || tagName === 'BUTTON' || tagName === 'SELECT' || tagName === 'TEXTAREA'; -} - -function useTabNav() { - const container = Object(external_wp_element_["useRef"])(); - const focusCaptureBeforeRef = Object(external_wp_element_["useRef"])(); - const focusCaptureAfterRef = Object(external_wp_element_["useRef"])(); - const lastFocus = Object(external_wp_element_["useRef"])(); - const { - hasMultiSelection, - getSelectedBlockClientId - } = Object(external_wp_data_["useSelect"])(store); - const { - setNavigationMode - } = Object(external_wp_data_["useDispatch"])(store); - const isNavigationMode = Object(external_wp_data_["useSelect"])(select => select(store).isNavigationMode(), []); // Don't allow tabbing to this element in Navigation mode. - - const focusCaptureTabIndex = !isNavigationMode ? '0' : undefined; // Reference that holds the a flag for enabling or disabling - // capturing on the focus capture elements. - - const noCapture = Object(external_wp_element_["useRef"])(); - - function onFocusCapture(event) { - // Do not capture incoming focus if set by us in WritingFlow. - if (noCapture.current) { - noCapture.current = null; - } else if (hasMultiSelection()) { - container.current.focus(); - } else if (getSelectedBlockClientId()) { - lastFocus.current.focus(); - } else { - setNavigationMode(true); - const isBefore = // eslint-disable-next-line no-bitwise - event.target.compareDocumentPosition(container.current) & event.target.DOCUMENT_POSITION_FOLLOWING; - const action = isBefore ? 'findNext' : 'findPrevious'; - external_wp_dom_["focus"].tabbable[action](event.target).focus(); - } - } - - const before = Object(external_wp_element_["createElement"])("div", { - ref: focusCaptureBeforeRef, - tabIndex: focusCaptureTabIndex, - onFocus: onFocusCapture - }); - const after = Object(external_wp_element_["createElement"])("div", { - ref: focusCaptureAfterRef, - tabIndex: focusCaptureTabIndex, - onFocus: onFocusCapture - }); - const ref = Object(external_wp_compose_["useRefEffect"])(node => { - function onKeyDown(event) { - if (event.keyCode === external_wp_keycodes_["ESCAPE"] && !hasMultiSelection()) { - event.stopPropagation(); - event.preventDefault(); - setNavigationMode(true); - return; - } // In Edit mode, Tab should focus the first tabbable element after - // the content, which is normally the sidebar (with block controls) - // and Shift+Tab should focus the first tabbable element before the - // content, which is normally the block toolbar. - // Arrow keys can be used, and Tab and arrow keys can be used in - // Navigation mode (press Esc), to navigate through blocks. - - - if (event.keyCode !== external_wp_keycodes_["TAB"]) { - return; - } - - const isShift = event.shiftKey; - const direction = isShift ? 'findPrevious' : 'findNext'; - - if (!hasMultiSelection() && !getSelectedBlockClientId()) { - // Preserve the behaviour of entering navigation mode when - // tabbing into the content without a block selection. - // `onFocusCapture` already did this previously, but we need to - // do it again here because after clearing block selection, - // focus land on the writing flow container and pressing Tab - // will no longer send focus through the focus capture element. - if (event.target === node) setNavigationMode(true); - return; - } // Allow tabbing between form elements rendered in a block, - // such as inside a placeholder. Form elements are generally - // meant to be UI rather than part of the content. Ideally - // these are not rendered in the content and perhaps in the - // future they can be rendered in an iframe or shadow DOM. - - - if (isFormElement(event.target) && isFormElement(external_wp_dom_["focus"].tabbable[direction](event.target))) { - return; - } - - const next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef; // Disable focus capturing on the focus capture element, so it - // doesn't refocus this block and so it allows default behaviour - // (moving focus to the next tabbable element). - - noCapture.current = true; // Focusing the focus capture element, which is located above and - // below the editor, should not scroll the page all the way up or - // down. - - next.current.focus({ - preventScroll: true - }); - } - - function onFocusOut(event) { - lastFocus.current = event.target; - } // When tabbing back to an element in block list, this event handler prevents scrolling if the - // focus capture divs (before/after) are outside of the viewport. (For example shift+tab back to a paragraph - // when focus is on a sidebar element. This prevents the scrollable writing area from jumping either to the - // top or bottom of the document. - // - // Note that it isn't possible to disable scrolling in the onFocus event. We need to intercept this - // earlier in the keypress handler, and call focus( { preventScroll: true } ) instead. - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus#parameters - - - function preventScrollOnTab(event) { - var _event$target; - - if (event.keyCode !== external_wp_keycodes_["TAB"]) { - return; - } - - if (((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.getAttribute('role')) === 'region') { - return; - } - - if (container.current === event.target) { - return; - } - - const isShift = event.shiftKey; - const direction = isShift ? 'findPrevious' : 'findNext'; - const target = external_wp_dom_["focus"].tabbable[direction](event.target); // only do something when the next tabbable is a focus capture div (before/after) - - if (target === focusCaptureBeforeRef.current || target === focusCaptureAfterRef.current) { - event.preventDefault(); - target.focus({ - preventScroll: true - }); - } - } - - node.ownerDocument.defaultView.addEventListener('keydown', preventScrollOnTab); - node.addEventListener('keydown', onKeyDown); - node.addEventListener('focusout', onFocusOut); - return () => { - node.ownerDocument.defaultView.removeEventListener('keydown', preventScrollOnTab); - node.removeEventListener('keydown', onKeyDown); - node.removeEventListener('focusout', onFocusOut); - }; - }, []); - const mergedRefs = Object(external_wp_compose_["useMergeRefs"])([container, ref]); - return [before, mergedRefs, after]; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-arrow-nav.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - -/** - * 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) { - const isVertical = keyCode === external_wp_keycodes_["UP"] || keyCode === external_wp_keycodes_["DOWN"]; // Currently, all elements support unmodified vertical navigation. - - if (isVertical && !hasModifier) { - return true; - } // Native inputs should not navigate horizontally. - - - const { - tagName - } = element; - return tagName !== 'INPUT' && tagName !== 'TEXTAREA'; -} -/** - * 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. - * @param {Element} containerElement Element containing all blocks. - * @param {boolean} onlyVertical Whether to only consider tabbable elements - * that are visually above or under the - * target. - * - * @return {?Element} Optimal tab target, if one exists. - */ - -function getClosestTabbable(target, isReverse, containerElement, onlyVertical) { - // Since the current focus target is not guaranteed to be a text field, find - // all focusables. Tabbability is considered later. - let focusableNodes = external_wp_dom_["focus"].focusable.find(containerElement); - - 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); - let targetRect; - - if (onlyVertical) { - targetRect = target.getBoundingClientRect(); - } - - function isTabCandidate(node) { - // Not a candidate if the node is not tabbable. - if (!external_wp_dom_["focus"].tabbable.isTabbableIndex(node)) { - return false; - } // Skip focusable elements such as links within content editable nodes. - - - if (node.isContentEditable && node.contentEditable !== 'true') { - return false; - } - - if (onlyVertical) { - const nodeRect = node.getBoundingClientRect(); - - if (nodeRect.left >= targetRect.right || nodeRect.right <= targetRect.left) { - return false; - } - } - - return true; - } - - return Object(external_lodash_["find"])(focusableNodes, isTabCandidate); -} -function useArrowNav() { - const { - getSelectedBlockClientId, - getMultiSelectedBlocksStartClientId, - getMultiSelectedBlocksEndClientId, - getPreviousBlockClientId, - getNextBlockClientId, - getFirstMultiSelectedBlockClientId, - getLastMultiSelectedBlockClientId, - getSettings, - hasMultiSelection - } = Object(external_wp_data_["useSelect"])(store); - const { - multiSelect, - selectBlock - } = Object(external_wp_data_["useDispatch"])(store); - return Object(external_wp_compose_["useRefEffect"])(node => { - // Here a DOMRect 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. - let verticalRect; - - function onMouseDown() { - verticalRect = null; - } - - function expandSelection(isReverse) { - const selectedBlockClientId = getSelectedBlockClientId(); - const selectionStartClientId = getMultiSelectedBlocksStartClientId(); - const selectionEndClientId = getMultiSelectedBlocksEndClientId(); - const selectionBeforeEndClientId = getPreviousBlockClientId(selectionEndClientId || selectedBlockClientId); - const selectionAfterEndClientId = getNextBlockClientId(selectionEndClientId || selectedBlockClientId); - const nextSelectionEndClientId = isReverse ? selectionBeforeEndClientId : selectionAfterEndClientId; - - if (nextSelectionEndClientId) { - if (selectionStartClientId === nextSelectionEndClientId) { - selectBlock(nextSelectionEndClientId); - } else { - multiSelect(selectionStartClientId || selectedBlockClientId, nextSelectionEndClientId); - } - } - } - - function moveSelection(isReverse) { - const selectedFirstClientId = getFirstMultiSelectedBlockClientId(); - const selectedLastClientId = getLastMultiSelectedBlockClientId(); - const focusedBlockClientId = isReverse ? selectedFirstClientId : selectedLastClientId; - - if (focusedBlockClientId) { - selectBlock(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. - */ - - - function isTabbableEdge(target, isReverse) { - const closestTabbable = getClosestTabbable(target, isReverse, node); - return !closestTabbable || !isInSameBlock(target, closestTabbable); - } - - function onKeyDown(event) { - const { - keyCode, - target - } = event; - const isUp = keyCode === external_wp_keycodes_["UP"]; - const isDown = keyCode === external_wp_keycodes_["DOWN"]; - const isLeft = keyCode === external_wp_keycodes_["LEFT"]; - const isRight = keyCode === external_wp_keycodes_["RIGHT"]; - const isReverse = isUp || isLeft; - const isHorizontal = isLeft || isRight; - const isVertical = isUp || isDown; - const isNav = isHorizontal || isVertical; - const isShift = event.shiftKey; - const hasModifier = isShift || event.ctrlKey || event.altKey || event.metaKey; - const isNavEdge = isVertical ? external_wp_dom_["isVerticalEdge"] : external_wp_dom_["isHorizontalEdge"]; - const { - ownerDocument - } = node; - const { - defaultView - } = ownerDocument; - - if (hasMultiSelection()) { - if (isNav) { - const action = isShift ? expandSelection : moveSelection; - action(isReverse); - event.preventDefault(); - } - - return; - } // When presing any key other than up or down, the initial vertical - // position must ALWAYS be reset. The vertical position is saved so - // it can be restored as well as possible on sebsequent vertical - // arrow key presses. It may not always be possible to restore the - // exact same position (such as at an empty line), so it wouldn't be - // good to compute the position right before any vertical arrow key - // press. - - - if (!isVertical) { - verticalRect = null; - } else if (!verticalRect) { - verticalRect = Object(external_wp_dom_["computeCaretRect"])(defaultView); - } // Abort if navigation has already been handled (e.g. RichText - // inline boundaries). - - - if (event.defaultPrevented) { - return; - } - - if (!isNav) { - return; - } // Abort if our current target is not a candidate for navigation - // (e.g. preserve native input behaviors). - - - if (!isNavigationCandidate(target, keyCode, hasModifier)) { - return; - } // In the case of RTL scripts, right means previous and left means - // next, which is the exact reverse of LTR. - - - const isReverseDir = Object(external_wp_dom_["isRTL"])(target) ? !isReverse : isReverse; - const { - keepCaretInsideBlock - } = getSettings(); - const selectedBlockClientId = getSelectedBlockClientId(); - - if (isShift) { - const selectionEndClientId = getMultiSelectedBlocksEndClientId(); - const selectionBeforeEndClientId = getPreviousBlockClientId(selectionEndClientId || selectedBlockClientId); - const selectionAfterEndClientId = getNextBlockClientId(selectionEndClientId || selectedBlockClientId); - - if ( // Ensure that there is a target block. - (isReverse && selectionBeforeEndClientId || !isReverse && selectionAfterEndClientId) && 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. - expandSelection(isReverse); - event.preventDefault(); - } - } else if (isVertical && Object(external_wp_dom_["isVerticalEdge"])(target, isReverse) && !keepCaretInsideBlock) { - const closestTabbable = getClosestTabbable(target, isReverse, node, true); - - if (closestTabbable) { - Object(external_wp_dom_["placeCaretAtVerticalEdge"])(closestTabbable, isReverse, verticalRect); - event.preventDefault(); - } - } else if (isHorizontal && defaultView.getSelection().isCollapsed && Object(external_wp_dom_["isHorizontalEdge"])(target, isReverseDir) && !keepCaretInsideBlock) { - const closestTabbable = getClosestTabbable(target, isReverseDir, node); - Object(external_wp_dom_["placeCaretAtHorizontalEdge"])(closestTabbable, isReverse); - event.preventDefault(); - } - } - - node.addEventListener('mousedown', onMouseDown); - node.addEventListener('keydown', onKeyDown); - return () => { - node.removeEventListener('mousedown', onMouseDown); - node.removeEventListener('keydown', onKeyDown); - }; - }, []); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-select-all.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - -function useSelectAll() { - const { - getBlockOrder, - getSelectedBlockClientIds, - getBlockRootClientId - } = Object(external_wp_data_["useSelect"])(store); - const { - multiSelect - } = Object(external_wp_data_["useDispatch"])(store); - const isMatch = Object(external_wp_keyboardShortcuts_["__unstableUseShortcutEventMatch"])(); - return Object(external_wp_compose_["useRefEffect"])(node => { - function onKeyDown(event) { - if (!isMatch('core/block-editor/select-all', event)) { - return; - } - - if (!Object(external_wp_dom_["isEntirelySelected"])(event.target)) { - return; - } - - const selectedClientIds = getSelectedBlockClientIds(); - const [firstSelectedClientId] = selectedClientIds; - const rootClientId = getBlockRootClientId(firstSelectedClientId); - let blockClientIds = getBlockOrder(rootClientId); // If we have selected all sibling nested blocks, try selecting up a - // level. See: https://github.com/WordPress/gutenberg/pull/31859/ - - if (selectedClientIds.length === blockClientIds.length) { - blockClientIds = getBlockOrder(getBlockRootClientId(rootClientId)); - } - - const firstClientId = Object(external_lodash_["first"])(blockClientIds); - const lastClientId = Object(external_lodash_["last"])(blockClientIds); - - if (firstClientId === lastClientId) { - return; - } - - multiSelect(firstClientId, lastClientId); - event.preventDefault(); - } - - node.addEventListener('keydown', onKeyDown); - return () => { - node.removeEventListener('keydown', onKeyDown); - }; - }); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/index.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - - - - - -function WritingFlow({ - children, - ...props -}, forwardedRef) { - const [before, ref, after] = useTabNav(); - const hasMultiSelection = Object(external_wp_data_["useSelect"])(select => select(store).hasMultiSelection(), []); - return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, before, Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({}, props, { - ref: Object(external_wp_compose_["useMergeRefs"])([forwardedRef, ref, use_multi_selection_useMultiSelection(), useSelectAll(), useArrowNav()]), - className: classnames_default()(props.className, 'block-editor-writing-flow'), - tabIndex: -1, - "aria-label": hasMultiSelection ? Object(external_wp_i18n_["__"])('Multiple selected blocks') : undefined - }), children), after); -} -/** - * Handles selection and navigation across blocks. This component should be - * wrapped around BlockList. - * - * @param {Object} props Component properties. - * @param {WPElement} props.children Children to be rendered. - */ - - -/* harmony default export */ var writing_flow = (Object(external_wp_element_["forwardRef"])(WritingFlow)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-canvas-click-redirect/index.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - -/** - * 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. - */ - -const isTabbableTextField = Object(external_lodash_["overEvery"])([external_wp_dom_["isTextField"], external_wp_dom_["focus"].tabbable.isTabbableIndex]); -function useCanvasClickRedirect() { - return Object(external_wp_compose_["useRefEffect"])(node => { - function onMouseDown(event) { - // Only handle clicks on the canvas, not the content. - if (event.target !== node) { - return; - } - - const focusableNodes = external_wp_dom_["focus"].focusable.find(node); - const target = Object(external_lodash_["findLast"])(focusableNodes, isTabbableTextField); - - if (!target) { - return; - } - - const { - bottom - } = target.getBoundingClientRect(); // Ensure the click is below the last block. - - if (event.clientY < bottom) { - return; - } - - Object(external_wp_dom_["placeCaretAtHorizontalEdge"])(target, true); - event.preventDefault(); - } - - node.addEventListener('mousedown', onMouseDown); - return () => { - node.addEventListener('mousedown', onMouseDown); - }; - }, []); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/iframe/index.js - - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - -const BODY_CLASS_NAME = 'editor-styles-wrapper'; -const BLOCK_PREFIX = 'wp-block'; -/** - * Clones stylesheets targetting the editor canvas to the given document. A - * stylesheet is considered targetting the editor a canvas if it contains the - * `editor-styles-wrapper`, `wp-block`, or `wp-block-*` class selectors. - * - * Ideally, this hook should be removed in the future and styles should be added - * explicitly as editor styles. - * - * @param {Document} doc The document to append cloned stylesheets to. - */ - -function styleSheetsCompat(doc) { - // Search the document for stylesheets targetting the editor canvas. - Array.from(document.styleSheets).forEach(styleSheet => { - try { - // May fail for external styles. - // eslint-disable-next-line no-unused-expressions - styleSheet.cssRules; - } catch (e) { - return; - } - - const { - ownerNode, - cssRules - } = styleSheet; - - if (!cssRules) { - return; - } // Generally, ignore inline styles. We add inline styles belonging to a - // stylesheet later, which may or may not match the selectors. - - - if (ownerNode.tagName !== 'LINK') { - return; - } // Don't try to add the reset styles, which were removed as a dependency - // from `edit-blocks` for the iframe since we don't need to reset admin - // styles. - - - if (ownerNode.id === 'wp-reset-editor-styles-css') { - return; - } - - const isMatch = Array.from(cssRules).find(({ - selectorText - }) => selectorText && (selectorText.includes(`.${BODY_CLASS_NAME}`) || selectorText.includes(`.${BLOCK_PREFIX}`))); - - if (isMatch && !doc.getElementById(ownerNode.id)) { - // eslint-disable-next-line no-console - console.error(`Stylesheet ${ownerNode.id} was not properly added. -For blocks, use the block API's style (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#style) or editorStyle (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#editor-style). -For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles).`, ownerNode.outerHTML); - doc.head.appendChild(ownerNode.cloneNode(true)); // Add inline styles belonging to the stylesheet. - - const inlineCssId = ownerNode.id.replace('-css', '-inline-css'); - const inlineCssElement = document.getElementById(inlineCssId); - - if (inlineCssElement) { - doc.head.appendChild(inlineCssElement.cloneNode(true)); - } - } - }); -} -/** - * Bubbles some event types (keydown, keypress, and dragover) to parent document - * document to ensure that the keyboard shortcuts and drag and drop work. - * - * Ideally, we should remove event bubbling in the future. Keyboard shortcuts - * should be context dependent, e.g. actions on blocks like Cmd+A should not - * work globally outside the block editor. - * - * @param {Document} doc Document to attach listeners to. - */ - - -function bubbleEvents(doc) { - const { - defaultView - } = doc; - const { - frameElement - } = defaultView; - - function bubbleEvent(event) { - const prototype = Object.getPrototypeOf(event); - const constructorName = prototype.constructor.name; - const Constructor = window[constructorName]; - const init = {}; - - for (const key in event) { - init[key] = event[key]; - } - - if (event instanceof defaultView.MouseEvent) { - const rect = frameElement.getBoundingClientRect(); - init.clientX += rect.left; - init.clientY += rect.top; - } - - const newEvent = new Constructor(event.type, init); - const cancelled = !frameElement.dispatchEvent(newEvent); - - if (cancelled) { - event.preventDefault(); - } - } - - const eventTypes = ['keydown', 'keypress', 'dragover']; - - for (const name of eventTypes) { - doc.addEventListener(name, bubbleEvent); - } -} -/** - * Sets the document direction. - * - * Sets the `editor-styles-wrapper` class name on the body. - * - * Copies the `admin-color-*` class name to the body so that the admin color - * scheme applies to components in the iframe. - * - * @param {Document} doc Document to add class name to. - */ - - -function setBodyClassName(doc) { - doc.dir = document.dir; - doc.body.className = BODY_CLASS_NAME; - - for (const name of document.body.classList) { - if (name.startsWith('admin-color-')) { - doc.body.classList.add(name); - } else if (name === 'wp-embed-responsive') { - // Ideally ALL classes that are added through get_body_class should - // be added in the editor too, which we'll somehow have to get from - // the server in the future (which will run the PHP filters). - doc.body.classList.add('wp-embed-responsive'); - } - } -} - -function useParsedAssets(html) { - return Object(external_wp_element_["useMemo"])(() => { - const doc = document.implementation.createHTMLDocument(''); - doc.body.innerHTML = html; - return Array.from(doc.body.children); - }, [html]); -} - -async function loadScript(doc, { - id, - src -}) { - return new Promise((resolve, reject) => { - const script = doc.createElement('script'); - script.id = id; - - if (src) { - script.src = src; - - script.onload = () => resolve(); - - script.onerror = () => reject(); - } else { - resolve(); - } - - doc.head.appendChild(script); - }); -} - -function Iframe({ - contentRef, - children, - head, - ...props -}, ref) { - const [, forceRender] = Object(external_wp_element_["useReducer"])(() => ({})); - const [iframeDocument, setIframeDocument] = Object(external_wp_element_["useState"])(); - const styles = useParsedAssets(window.__editorAssets.styles); - const scripts = useParsedAssets(window.__editorAssets.scripts); - const clearerRef = useBlockSelectionClearer(); - const setRef = Object(external_wp_element_["useCallback"])(node => { - if (!node) { - return; - } - - function setDocumentIfReady() { - const { - contentDocument - } = node; - const { - readyState, - body, - documentElement - } = contentDocument; - - if (readyState !== 'interactive' && readyState !== 'complete') { - return false; - } - - if (typeof contentRef === 'function') { - contentRef(body); - } else if (contentRef) { - contentRef.current = body; - } - - setBodyClassName(contentDocument); - bubbleEvents(contentDocument); - setBodyClassName(contentDocument); - setIframeDocument(contentDocument); - clearerRef(documentElement); - clearerRef(body); - scripts.reduce((promise, script) => promise.then(() => loadScript(contentDocument, script)), Promise.resolve()).finally(() => { - // When script are loaded, re-render blocks to allow them - // to initialise. - forceRender(); - }); - return true; - } - - if (setDocumentIfReady()) { - return; - } // Document is not immediately loaded in Firefox. - - - node.addEventListener('load', () => { - setDocumentIfReady(); - }); - }, []); - Object(external_wp_element_["useEffect"])(() => { - if (iframeDocument) { - styleSheetsCompat(iframeDocument); - } - }, [iframeDocument]); - head = Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("style", null, 'body{margin:0}'), styles.map(({ - tagName, - href, - id, - rel, - media, - textContent - }) => { - const TagName = tagName.toLowerCase(); - - if (TagName === 'style') { - return Object(external_wp_element_["createElement"])(TagName, { - id, - key: id - }, textContent); - } - - return Object(external_wp_element_["createElement"])(TagName, { - href, - id, - rel, - media, - key: id - }); - }), head); - return Object(external_wp_element_["createElement"])("iframe", Object(esm_extends["a" /* default */])({}, props, { - ref: Object(external_wp_compose_["useMergeRefs"])([ref, setRef]), - tabIndex: "0", - title: Object(external_wp_i18n_["__"])('Editor canvas'), - name: "editor-canvas" - }), iframeDocument && Object(external_wp_element_["createPortal"])(Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalStyleProvider"], { - document: iframeDocument - }, children), iframeDocument.body), iframeDocument && Object(external_wp_element_["createPortal"])(head, iframeDocument.head)); -} - -/* harmony default export */ var iframe = (Object(external_wp_element_["forwardRef"])(Iframe)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-no-recursive-renders/index.js - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - -const RenderedRefsContext = Object(external_wp_element_["createContext"])({}); +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-no-recursive-renders/index.js + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + +const RenderedRefsContext = (0,external_wp_element_namespaceObject.createContext)({}); /** * Immutably adds an unique identifier to a set scoped for a given block type. * * @param {Object} renderedBlocks Rendered blocks grouped by block name * @param {string} blockName Name of the block. - * @param {*} uniqueId Any value that acts as a unique identifier for a block instance. + * @param {*} uniqueId Any value that acts as a unique identifier for a block instance. * * @return {Object} The list of rendered blocks grouped by block name. */ @@ -39657,25 +49370,29 @@ */ -function useNoRecursiveRenders(uniqueId, blockName = '') { +function useNoRecursiveRenders(uniqueId) { var _previouslyRenderedBl; - const previouslyRenderedBlocks = Object(external_wp_element_["useContext"])(RenderedRefsContext); + let blockName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + const previouslyRenderedBlocks = (0,external_wp_element_namespaceObject.useContext)(RenderedRefsContext); const { name } = useBlockEditContext(); blockName = blockName || name; const hasAlreadyRendered = Boolean((_previouslyRenderedBl = previouslyRenderedBlocks[blockName]) === null || _previouslyRenderedBl === void 0 ? void 0 : _previouslyRenderedBl.has(uniqueId)); - const newRenderedBlocks = Object(external_wp_element_["useMemo"])(() => addToBlockType(previouslyRenderedBlocks, blockName, uniqueId), [previouslyRenderedBlocks, blockName, uniqueId]); - const Provider = Object(external_wp_element_["useCallback"])(({ - children - }) => Object(external_wp_element_["createElement"])(RenderedRefsContext.Provider, { - value: newRenderedBlocks - }, children), [newRenderedBlocks]); + const newRenderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => addToBlockType(previouslyRenderedBlocks, blockName, uniqueId), [previouslyRenderedBlocks, blockName, uniqueId]); + const Provider = (0,external_wp_element_namespaceObject.useCallback)(_ref => { + let { + children + } = _ref; + return (0,external_wp_element_namespaceObject.createElement)(RenderedRefsContext.Provider, { + value: newRenderedBlocks + }, children); + }, [newRenderedBlocks]); return [hasAlreadyRendered, Provider]; } -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/index.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/index.js /* * Block Creation Components */ @@ -39739,6 +49456,10 @@ + + + + /* * Content Related Components */ @@ -39785,301 +49506,345 @@ - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/theme.js -/** - * Internal dependencies - */ - -/** - * Given an array of theme colors checks colors for validity - * - * @param {Array} colors The array of theme colors - * - * @return {Array} The array of valid theme colors or the default colors - */ - -function validateThemeColors(colors) { - if (colors === undefined) { - colors = SETTINGS_DEFAULTS.colors; - } else { - const validColors = colors.filter(c => c.color); - - if (validColors.length === 0) { - colors = SETTINGS_DEFAULTS.colors; - } else if (validColors.length < colors.length) { - // Filter out invalid colors - colors = validColors; - } - } - - return colors; -} -/** - * Given an array of theme gradients checks gradients for validity - * - * @param {Array} gradients The array of theme gradients - * - * @return {Array} The array of valid theme gradients or the default gradients - */ - -function validateThemeGradients(gradients) { - if (gradients === undefined) { - gradients = SETTINGS_DEFAULTS.gradients; - } else { - const validGradients = gradients.filter(c => c.gradient); - - if (validGradients.length === 0) { - gradients = SETTINGS_DEFAULTS.gradients; - } else if (validGradients.length < gradients.length) { - // Filter out invalid gradients - gradients = validGradients; - } - } - - return gradients; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/index.js - - - - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/index.js -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - - - - - - - - -/***/ }), - -/***/ "w95h": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const close = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z" -})); -/* harmony default export */ __webpack_exports__["a"] = (close); - - -/***/ }), - -/***/ "wx14": -/***/ (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); -} - -/***/ }), - -/***/ "xTGt": -/***/ (function(module, exports) { - -(function() { module.exports = window["wp"]["blob"]; }()); - -/***/ }), - -/***/ "ziDm": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -const alignRight = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M11.1 19.8H20v-1.5h-8.9v1.5zm0-15.6v1.5H20V4.2h-8.9zM4 12.8h16v-1.5H4v1.5z" -})); -/* harmony default export */ __webpack_exports__["a"] = (alignRight); - - -/***/ }), - -/***/ "zt9T": -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var util = __webpack_require__("jB5C"); - -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; - -/***/ }) - -/******/ }); \ No newline at end of file +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/block-variation-transforms.js +/** + * External dependencies + */ + +/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */ + +/** + * Matches the provided block variations with a block's attributes. If no match + * or more than one matches are found it returns `undefined`. If a single match is + * found it returns it. + * + * This is a simple implementation for now as it takes into account only the attributes + * of a block variation and not `InnerBlocks`. + * + * @param {Object} blockAttributes - The block attributes to try to find a match. + * @param {WPBlockVariation[]} variations - A list of block variations to test for a match. + * @return {?WPBlockVariation} - If a match is found returns it. If not or more than one matches are found returns `undefined`. + */ + +const __experimentalGetMatchingVariation = (blockAttributes, variations) => { + if (!variations || !blockAttributes) return; + const matches = variations.filter(_ref => { + let { + attributes + } = _ref; + if (!attributes || !Object.keys(attributes).length) return false; + return (0,external_lodash_namespaceObject.isMatch)(blockAttributes, attributes); + }); + if (matches.length !== 1) return; + return matches[0]; +}; + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/parse-css-unit-to-px.js +/** + * Converts string to object { value, unit }. + * + * @param {string} cssUnit + * @return {Object} parsedUnit + */ +function parseUnit(cssUnit) { + const match = cssUnit === null || cssUnit === void 0 ? void 0 : cssUnit.trim().match(/^(0?[-.]?\d*\.?\d+)(r?e[m|x]|v[h|w|min|max]+|p[x|t|c]|[c|m]m|%|in|ch|Q|lh)$/); + + if (!isNaN(cssUnit) && !isNaN(parseFloat(cssUnit))) { + return { + value: parseFloat(cssUnit), + unit: 'px' + }; + } + + return match ? { + value: parseFloat(match[1]) || match[1], + unit: match[2] + } : { + value: cssUnit, + unit: undefined + }; +} +/** + * Evaluate a math expression. + * + * @param {string} expression + * @return {number} evaluated expression. + */ + + +function calculate(expression) { + return Function(`'use strict'; return (${expression})`)(); +} +/** + * Calculates the css function value for the supported css functions such as max, min, clamp and calc. + * + * @param {string} functionUnitValue string should be in a particular format (for example min(12px,12px) ) no nested loops. + * @param {Object} options + * @return {string} unit containing the unit in PX. + */ + + +function getFunctionUnitValue(functionUnitValue, options) { + const functionUnit = functionUnitValue.split(/[(),]/g).filter(Boolean); + const units = functionUnit.slice(1).map(unit => parseUnit(getPxFromCssUnit(unit, options)).value).filter(Boolean); + + switch (functionUnit[0]) { + case 'min': + return Math.min(...units) + 'px'; + + case 'max': + return Math.max(...units) + 'px'; + + case 'clamp': + if (units.length !== 3) { + return null; + } + + if (units[1] < units[0]) { + return units[0] + 'px'; + } + + if (units[1] > units[2]) { + return units[2] + 'px'; + } + + return units[1] + 'px'; + + case 'calc': + return units[0] + 'px'; + } +} +/** + * Take a css function such as min, max, calc, clamp and returns parsedUnit + * + * How this works for the nested function is that it first replaces the inner function call. + * Then it tackles the outer onces. + * So for example: min( max(25px, 35px), 40px ) + * in the first pass we would replace max(25px, 35px) with 35px. + * then we would try to evaluate min( 35px, 40px ) + * and then finally return 35px. + * + * @param {string} cssUnit + * @return {Object} parsedUnit object. + */ + + +function parseUnitFunction(cssUnit) { + while (true) { + const currentCssUnit = cssUnit; + const regExp = /(max|min|calc|clamp)\(([^()]*)\)/g; + const matches = regExp.exec(cssUnit) || []; + + if (matches[0]) { + const functionUnitValue = getFunctionUnitValue(matches[0]); + cssUnit = cssUnit.replace(matches[0], functionUnitValue); + } // If the unit hasn't been modified or we have a single value break free. + + + if (cssUnit === currentCssUnit || parseFloat(cssUnit)) { + break; + } + } + + return parseUnit(cssUnit); +} +/** + * Return true if we think this is a math expression. + * + * @param {string} cssUnit the cssUnit value being evaluted. + * @return {boolean} Whether the cssUnit is a math expression. + */ + + +function isMathExpression(cssUnit) { + for (let i = 0; i < cssUnit.length; i++) { + if (['+', '-', '/', '*'].includes(cssUnit[i])) { + return true; + } + } + + return false; +} +/** + * Evaluates the math expression and return a px value. + * + * @param {string} cssUnit the cssUnit value being evaluted. + * @return {string} return a converfted value to px. + */ + + +function evalMathExpression(cssUnit) { + let errorFound = false; // Convert every part of the expression to px values. + + const cssUnitsBits = cssUnit.split(/[+-/*/]/g).filter(Boolean); + + for (const unit of cssUnitsBits) { + // Standardize the unit to px and extract the value. + const parsedUnit = parseUnit(getPxFromCssUnit(unit)); + + if (!parseFloat(parsedUnit.value)) { + errorFound = true; // End early since we are dealing with a null value. + + break; + } + + cssUnit = cssUnit.replace(unit, parsedUnit.value); + } + + return errorFound ? null : calculate(cssUnit).toFixed(0) + 'px'; +} +/** + * Convert a parsedUnit object to px value. + * + * @param {Object} parsedUnit + * @param {Object} options + * @return {string} or {null} returns the converted with in a px value format. + */ + + +function convertParsedUnitToPx(parsedUnit, options) { + const PIXELS_PER_INCH = 96; + const ONE_PERCENT = 0.01; + const defaultProperties = { + fontSize: 16, + lineHeight: 16, + width: 375, + height: 812, + type: 'font' + }; + const setOptions = Object.assign({}, defaultProperties, options); + const relativeUnits = { + em: setOptions.fontSize, + rem: setOptions.fontSize, + vh: setOptions.height * ONE_PERCENT, + vw: setOptions.width * ONE_PERCENT, + vmin: (setOptions.width < setOptions.height ? setOptions.width : setOptions.height) * ONE_PERCENT, + vmax: (setOptions.width > setOptions.height ? setOptions.width : setOptions.height) * ONE_PERCENT, + '%': (setOptions.type === 'font' ? setOptions.fontSize : setOptions.width) * ONE_PERCENT, + ch: 8, + // The advance measure (width) of the glyph "0" of the element's font. Approximate + ex: 7.15625, + // X-height of the element's font. Approximate. + lh: setOptions.lineHeight + }; + const absoluteUnits = { + in: PIXELS_PER_INCH, + cm: PIXELS_PER_INCH / 2.54, + mm: PIXELS_PER_INCH / 25.4, + pt: PIXELS_PER_INCH / 72, + pc: PIXELS_PER_INCH / 6, + px: 1, + Q: PIXELS_PER_INCH / 2.54 / 40 + }; + + if (relativeUnits[parsedUnit.unit]) { + return (relativeUnits[parsedUnit.unit] * parsedUnit.value).toFixed(0) + 'px'; + } + + if (absoluteUnits[parsedUnit.unit]) { + return (absoluteUnits[parsedUnit.unit] * parsedUnit.value).toFixed(0) + 'px'; + } + + return null; +} +/** + * Returns the px value of a cssUnit. + * + * @param {string} cssUnit + * @param {Object} options + * @return {string} returns the cssUnit value in a simple px format. + */ + + +function getPxFromCssUnit(cssUnit) { + let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + if (Number.isFinite(cssUnit)) { + return cssUnit.toFixed(0) + 'px'; + } + + if (cssUnit === undefined) { + return null; + } + + let parsedUnit = parseUnit(cssUnit); + + if (!parsedUnit.unit) { + parsedUnit = parseUnitFunction(cssUnit, options); + } + + if (isMathExpression(cssUnit) && !parsedUnit.unit) { + return evalMathExpression(cssUnit); + } + + return convertParsedUnitToPx(parsedUnit, options); +} // Use simple cache. + +const cache = {}; +/** + * Returns the px value of a cssUnit. The memoized version of getPxFromCssUnit; + * + * @param {string} cssUnit + * @param {Object} options + * @return {string} returns the cssUnit value in a simple px format. + */ + +function memoizedGetPxFromCssUnit(cssUnit) { + let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + const hash = cssUnit + hashOptions(options); + + if (!cache[hash]) { + cache[hash] = getPxFromCssUnit(cssUnit, options); + } + + return cache[hash]; +} + +function hashOptions(options) { + let hash = ''; + + if (options.hasOwnProperty('fontSize')) { + hash = ':' + options.width; + } + + if (options.hasOwnProperty('lineHeight')) { + hash = ':' + options.lineHeight; + } + + if (options.hasOwnProperty('width')) { + hash = ':' + options.width; + } + + if (options.hasOwnProperty('height')) { + hash = ':' + options.height; + } + + if (options.hasOwnProperty('type')) { + hash = ':' + options.type; + } + + return hash; +} + +/* harmony default export */ var parse_css_unit_to_px = (memoizedGetPxFromCssUnit); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/index.js + + + + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/index.js +/** + * Internal dependencies + */ + + + + + + + +}(); +(window.wp = window.wp || {}).blockEditor = __webpack_exports__; +/******/ })() +; \ No newline at end of file